From 21b9bed09b7bb6b7393aeb6466a23bd731d0b36d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=95=D0=BB=D0=B5=D0=BD=D0=B0=20=D0=91=D0=B0=D0=BA=D0=B0?= =?UTF-8?q?=D0=BB=D1=8C=D1=81=D0=BA=D0=B0=D1=8F?= Date: Sun, 26 May 2024 18:16:46 +0400 Subject: [PATCH] =?UTF-8?q?=D0=BD=D1=83...=20=D0=BF=D1=80=D0=BE=D1=86?= =?UTF-8?q?=D0=B5=D0=B4=D1=83=D1=80=D0=B0=20=D1=81=D0=BE=D0=B7=D0=B4=D0=B0?= =?UTF-8?q?=D0=B5=D1=82=D1=81=D1=8F,=20=D0=BD=D0=BE=20=D0=BF=D0=BE=D0=BA?= =?UTF-8?q?=D0=B0=20=D0=BD=D0=B5=20=D0=BC=D0=B5=D0=BD=D1=8F=D0=B5=D1=82?= =?UTF-8?q?=D1=81=D1=8F=20(=D0=BD=D0=B5=20=D0=B0=D0=BF=D0=B4=D0=B5=D0=B9?= =?UTF-8?q?=D1=82=D0=B8=D1=82=D1=81=D1=8F)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/HomeController.cs | 50 +++++++++- .../Views/Home/CreateProcedure.cshtml | 20 ++-- .../Views/Home/Procedures.cshtml | 92 ++++++++----------- 3 files changed, 94 insertions(+), 68 deletions(-) diff --git a/Polyclinic/PolyclinicWebAppSuretor/Controllers/HomeController.cs b/Polyclinic/PolyclinicWebAppSuretor/Controllers/HomeController.cs index 832d428..fd060dc 100644 --- a/Polyclinic/PolyclinicWebAppSuretor/Controllers/HomeController.cs +++ b/Polyclinic/PolyclinicWebAppSuretor/Controllers/HomeController.cs @@ -1,5 +1,8 @@ using Microsoft.AspNetCore.Mvc; +using PolyclinicBusinessLogic.BusinessLogics; +using PolyclinicContracts.BindingModels; using PolyclinicContracts.BusinessLogicsContracts; +using PolyclinicContracts.SearchModels; using PolyclinicContracts.ViewModels; using PolyclinicWebAppSuretor.Models; using System.Diagnostics; @@ -52,9 +55,52 @@ namespace PolyclinicWebAppSuretor.Controllers return View(); } - public IActionResult CreateProcedure() + [HttpGet] + [HttpPost] + public IActionResult CreateProcedure(string name, string? comment, DateTime dateStart, DateTime? dateStop) { - return View(); + if (HttpContext.Request.Method == "GET") + { + ViewData["Title"] = " "; + return View(); + } + else + { + // TODO UserId + ProcedureBindingModel procedure = new ProcedureBindingModel + { + Name = name, + Comment = comment ?? string.Empty, + DateStartProcedure = dateStart, + DateStopProcedure = dateStop + }; + _procedureLogic.Create(procedure); + return RedirectToAction("Procedures"); + } + } + [HttpGet] + [HttpPost] + public IActionResult Edit(int id, string name, string comment, DateTime dateStart, DateTime? dateStop) + { + if (HttpContext.Request.Method == "GET") + { + var obj = _procedureLogic.ReadElement(new ProcedureSearchModel { Id = id }); + ViewData["Title"] = " "; + return View(obj); + } + else + { + ProcedureBindingModel procedure = new ProcedureBindingModel + { + Id = id, + Name = name, + Comment = comment ?? string.Empty, + DateStartProcedure = dateStart, + DateStopProcedure = dateStop + }; + _procedureLogic.Update(procedure); + return RedirectToAction("Procedures"); + } } public IActionResult CreateMedicament() diff --git a/Polyclinic/PolyclinicWebAppSuretor/Views/Home/CreateProcedure.cshtml b/Polyclinic/PolyclinicWebAppSuretor/Views/Home/CreateProcedure.cshtml index a9562a3..16c094a 100644 --- a/Polyclinic/PolyclinicWebAppSuretor/Views/Home/CreateProcedure.cshtml +++ b/Polyclinic/PolyclinicWebAppSuretor/Views/Home/CreateProcedure.cshtml @@ -1,5 +1,5 @@ @using PolyclinicContracts.ViewModels -@model List +@model ProcedureViewModel @{ ViewData["Title"] = "CreateProcedure"; } @@ -10,40 +10,38 @@
- +

Название:

- +

Комментарий:

-
-
-
-
- +
\ No newline at end of file diff --git a/Polyclinic/PolyclinicWebAppSuretor/Views/Home/Procedures.cshtml b/Polyclinic/PolyclinicWebAppSuretor/Views/Home/Procedures.cshtml index 66cb332..2946c54 100644 --- a/Polyclinic/PolyclinicWebAppSuretor/Views/Home/Procedures.cshtml +++ b/Polyclinic/PolyclinicWebAppSuretor/Views/Home/Procedures.cshtml @@ -7,76 +7,58 @@

Процедуры

-
+
@{ // if (Model == null) // { //

Авторизируйтесь

// return; // } -

- Создать процедуру -

+ - - - - - - - + + + + + + + - @foreach (var item in Model) + + @foreach (var item in Model) { - - - - - - - + + + + + + + + + } +
- Номер - - Название процедуры - - Дата начала процедуры - - Дата окончания процедуры - - Комментарий - - Редактировать - - Удалить - НомерНазвание процедурыДата начала процедурыДата окончания процедурыКомментарийРедактироватьУдалить
- @Html.DisplayFor(modelItem => item.Id) - - @Html.DisplayFor(modelItem => item.Name) - - @Html.DisplayFor(modelItem => item.DateStartProcedure) - - @Html.DisplayFor(modelItem => item.DateStopProcedure) - - @Html.DisplayFor(modelItem => item.Comment) - - - - - - - - - - - - -
@Html.DisplayFor(modelItem => item.Id)@Html.DisplayFor(modelItem => item.Name)@Html.DisplayFor(modelItem => item.DateStartProcedure)@Html.DisplayFor(modelItem => item.DateStopProcedure)@Html.DisplayFor(modelItem => item.Comment) + + + + + + + + + + + +
}