diff --git a/Polyclinic/PolyclinicDatabaseImplement/Models/Recipe.cs b/Polyclinic/PolyclinicDatabaseImplement/Models/Recipe.cs index 1deb276..a81b80b 100644 --- a/Polyclinic/PolyclinicDatabaseImplement/Models/Recipe.cs +++ b/Polyclinic/PolyclinicDatabaseImplement/Models/Recipe.cs @@ -16,7 +16,7 @@ namespace PolyclinicDatabaseImplement.Models public string? Comment { get; set; } = string.Empty; public int? CourseId { get; set; } - public virtual Course Course { get; set; } = new(); + public virtual Course? Course { get; set; } private Dictionary? _recipeProcedures = null; @@ -63,7 +63,7 @@ namespace PolyclinicDatabaseImplement.Models Id = Id, ProceduresCount = ProceduresCount, Comment = Comment, - CourseId = Course?.Id ?? null, + CourseId = CourseId ?? null, }; public void UpdateProcedures(PolyclinicDatabase database, RecipeBindingModel bindingModel) diff --git a/Polyclinic/PolyclinicWebAppSuretor/Controllers/HomeController.cs b/Polyclinic/PolyclinicWebAppSuretor/Controllers/HomeController.cs index c700dcb..a2185f1 100644 --- a/Polyclinic/PolyclinicWebAppSuretor/Controllers/HomeController.cs +++ b/Polyclinic/PolyclinicWebAppSuretor/Controllers/HomeController.cs @@ -48,6 +48,11 @@ namespace PolyclinicWebAppSuretor.Controllers return View(); } + /// + /// RECIPES + /// + /// + public IActionResult Recipes() { List recipes = _recipeLogic.ReadList(null); @@ -62,7 +67,7 @@ namespace PolyclinicWebAppSuretor.Controllers [HttpPost] public IActionResult CreateRecipe(RecipeModel model, int[] selectedProcedures) { - ViewBag.Courses = _courseLogic.ReadList(null); + ViewBag.Courses = _courseLogic.ReadList(); if (HttpContext.Request.Method == "GET") { ViewData["Title"] = " "; @@ -138,6 +143,11 @@ namespace PolyclinicWebAppSuretor.Controllers return RedirectToAction("Recipes"); } + /// + /// MEDICAMENTS + /// + /// + public IActionResult Medicaments() { List medicaments = _medicamentLogic.ReadList(null); diff --git a/Polyclinic/PolyclinicWebAppSuretor/Views/Home/CreateRecipe.cshtml b/Polyclinic/PolyclinicWebAppSuretor/Views/Home/CreateRecipe.cshtml index a514401..8155796 100644 --- a/Polyclinic/PolyclinicWebAppSuretor/Views/Home/CreateRecipe.cshtml +++ b/Polyclinic/PolyclinicWebAppSuretor/Views/Home/CreateRecipe.cshtml @@ -29,7 +29,7 @@

Курс (номер):

- @foreach (var course in ViewBag.Courses) {