Url.Action
принимает аргумент object? values
(последний). В него нужно передать параметры для обработчика MVC контроллера. Передавать в виде анонимного объекта.@foreach (var item in Model)
{
<tr onclick="location.href='@Url.Action("ViewOrder", "Home", new { id = item.Id })'">
<td>@item.Id</td>
<td>@item.CitySender</td>
<td>@item.AdressSender</td>
<td>@item.CityRecipient</td>
<td>@item.AdressRecipient</td>
<td>@item.Weight</td>
<td>@item.Date</td>
</tr>
}
public IActionResult ViewOrder(int id)
<DataGrid x:Name="HistoryDataGrid" RowEditEnding="HistoryDataGrid_RowEditEnding"></DataGrid>
<DataGrid x:Name="HistoryDataGrid" RowEditEnding="HistoryDataGrid_RowEditEnding" AutoGenerateColumns="False">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Action, UpdateSourceTrigger=PropertyChanged}" Header="Действие"/>
<DataGridTextColumn Binding="{Binding Person, UpdateSourceTrigger=PropertyChanged}" Header="Персона"/>
<DataGridTextColumn Binding="{Binding Date, UpdateSourceTrigger=PropertyChanged}" Header="Дата"/>
</DataGrid.Columns>
</DataGrid>
public interface ITalkingShape
{
string SayAboutYourself();
}
public class Square : ITalkingShape
{
string SayAboutYourself()
{
return $"figure is square. ■\nIts area is {Shape.GetArea(shape)}.\nIts perimeter is {Shape.GetPerimeter(shape)}.\n\n";
}
}
public static void Display(ITalkingShape shape)
{
Console.WriteLine(shape.SayAboutYourself())
}
double x = 12.3456789;
double y = 98.7654321;
QString str = QString("x: %1 y: %2").arg(x, 0, 'f', 3).arg(y, 0, 'f', 3);
OUT:
x: 12.346 y: 98.765
В чем ошибка?
if (miderate[i] > miderate[i + 1]) { swap (records[i].name, records[i + 1].name); swap (records[i].group, records[i + 1].group); swap(records[i].marks, records[i + 1].marks); }
swap(records[i], records[i + 1])
.При компиляцииуже при выполнении
ifstream ifs("debug/text.txt");
ifstream ifs("debug\\text.txt");
ifstream ifs("text.txt");
name1.compare(name2); //strcmp()
name1 == name2; //operator==
if (strcmp(name1, name2) == 1)
The strcmp() and strncmp() functions return an integer less than,
equal to, or greater than zero if s1 (or the first n bytes thereof)
is found, respectively, to be less than, to match, or be greater than
s2.
if (strcmp(name1.c_str(), name2.c_str()) == 0)
#include<iostream>
#include<string>
using namespace std;
int main()
{
setlocale(LC_ALL, "Russian");
system("chcp 1251 > null");
string s;
cout << "Введите имя: ";
while(getline(cin, s))
{
if(s.empty())
{
cout << "Вы не ввели имя!\n"
<< "Введите имя: ";
continue;
}
break;
}
cout << "\nВаше имя: " << s
<< "\nНажмите любую клавишу...";
cin.get();
}
#include<iostream>
#include<string>
#include<algorithm>
#include<cctype>
#include<clocale>
using namespace std;
/* functions from https://code-examples.net/ru/q/34ef7 */
// trim from start (in place)
static inline void ltrim(string &s)
{
s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](const auto ch) {
return !isspace(ch);
}));
}
// trim from end (in place)
static inline void rtrim(string &s)
{
s.erase(std::find_if(s.rbegin(), s.rend(), [](const auto ch) {
return !isspace(ch);
}).base(), s.end());
}
// trim from both ends (in place)
static inline void trim(string &s)
{
ltrim(s);
rtrim(s);
}
int main()
{
setlocale(LC_ALL, "Russian");
system("chcp 1251 > null");
string s;
cout << "Введите имя: ";
while(getline(cin, s))
{
//upd
replace_if(s.begin(), s.end(), [](const auto c){return iscntrl(c); }, ' ');
trim(s);
//end upd
if(s.empty())
{
cout << "Вы не ввели имя!\n"
<< "Введите имя: ";
continue;
}
break;
}
cout << "\nВаше имя: " << s
<< "\nНажмите любую клавишу...";
cin.get();
}