Код: Выделить всё
[url=@Url.Action(]My schedule[/url]
Код: Выделить всё
[url=@Url.Action(]Smith's schedule[/url]
[url=@Url.Action(]Doe's schedule[/url]
Вот мое отображение маршрута:
Код: Выделить всё
app.MapControllerRoute(
name: "days-off-schedule",
pattern: $"DaysOff/DaysOffSchedule/{{personnelId}}", // with or without ? doesn't affect the behaviour
defaults: new {controller = "DaysOff", action = "DaysOffSchedule" });
app.MapControllerRoute(
name: "default",
pattern: $"{{controller=Home}}/{{action=Login}}/{{id?}}");
Код: Выделить всё
public class DaysOffController : Controller
{
public IActionResult DaysOffSchedule(int? personnelId)
{
return View(nameof(DaysOffSchedule), new SingleStringModel($"Hello {personnelId}"));
}
[HttpPost]
public IActionResult DaysOffSchedule(SingleStringModel model)
{
ModelState.Clear();
model.Text = $"{model.Text}. OK";
return View(nameof(DaysOffSchedule), model);
}
}
Подробнее здесь: https://stackoverflow.com/questions/782 ... nother-lin