Реализовал форму привязки рецепта к курсу

This commit is contained in:
Никита Потапов 2024-04-30 23:22:25 +04:00
parent bb331000f6
commit f807bea098
3 changed files with 57 additions and 1 deletions

View File

@ -90,6 +90,20 @@ namespace PolyclinicWebAppImplementer.Controllers
return View(); return View();
} }
[HttpGet]
[HttpPost]
public IActionResult AddRecipeToCourse()
{
if (HttpContext.Request.Method == "POST")
{
return Redirect("~/");
}
else
{
return View();
}
}
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error() public IActionResult Error()
{ {

View File

@ -12,10 +12,11 @@
public static (string Url, string Title) Login = ("Login", "Вход"); public static (string Url, string Title) Login = ("Login", "Вход");
public static (string Url, string Title) Register = ("Register", "Регистрация"); public static (string Url, string Title) Register = ("Register", "Регистрация");
public static (string Url, string Title) Privacy = ("Privacy", "Политика приватности"); public static (string Url, string Title) Privacy = ("Privacy", "Политика приватности");
public static (string Url, string Title) AddRecipeToCourse = ("AddRecipeToCourse", "Привязка рецепта");
public static List<(string Url, string Title)> MenuItemsOrder = new List<(string Url, string Title)> public static List<(string Url, string Title)> MenuItemsOrder = new List<(string Url, string Title)>
{ {
Index, Courses, Diagnoses, Symptomes, Login, Register Index, Courses, Diagnoses, Symptomes, Login, Register, AddRecipeToCourse
}; };
} }
} }

View File

@ -0,0 +1,41 @@
@{
ViewBag.SelectedSiteMenuItem = SiteMenuItems.Course;
}
<h4>Привязка рецепта к курсу</h4>
<form id="addrecipetocourse" method="post">
<div class="row mb-2">
<div class="col-3 d-flex align-content-center">
<h5 class="me-2">Рецепт</h5>
<select id="recipeId" name="recipeId" class="me-2">
<option value="">Выберите рецепт</option>
@{
for (int i = 0; i < 10; i++)
{
<option value="@i">Рецепт оууеее @i</option>
}
}
</select>
</div>
</div>
<div class="row mb-2">
<div class="col-3 d-flex align-content-center">
<h5 class="me-2">Курс</h5>
<select id="courseId" name="courseId" class="me-2">
<option value="">Выберите курс</option>
@{
for (int i = 0; i < 10; i++)
{
<option value="@i">Какой то курс @i</option>
}
}
</select>
</div>
</div>
<div class="row mb-2">
<div class="col-3">
<button class="btn btn-primary" type="submit">
Привязать
</button>
</div>
</div>
</form>