Compare commits

...

2 Commits

2 changed files with 27 additions and 13 deletions

View File

@ -57,7 +57,7 @@ namespace PolyclinicWebAppSuretor.Controllers
[HttpGet] [HttpGet]
[HttpPost] [HttpPost]
public IActionResult CreateProcedure(string name, string? comment, DateTime dateStart, DateTime? dateStop) public IActionResult CreateProcedure(ProcedureViewModel model)
{ {
if (HttpContext.Request.Method == "GET") if (HttpContext.Request.Method == "GET")
{ {
@ -69,10 +69,10 @@ namespace PolyclinicWebAppSuretor.Controllers
// TODO ïðîïèñàòü UserId // TODO ïðîïèñàòü UserId
ProcedureBindingModel procedure = new ProcedureBindingModel ProcedureBindingModel procedure = new ProcedureBindingModel
{ {
Name = name, Name = model.Name,
Comment = comment ?? string.Empty, Comment = model.Comment ?? string.Empty,
DateStartProcedure = dateStart, DateStartProcedure = model.DateStartProcedure,
DateStopProcedure = dateStop DateStopProcedure = model.DateStopProcedure
}; };
_procedureLogic.Create(procedure); _procedureLogic.Create(procedure);
return RedirectToAction("Procedures"); return RedirectToAction("Procedures");
@ -104,6 +104,17 @@ namespace PolyclinicWebAppSuretor.Controllers
} }
} }
[HttpPost]
public IActionResult DeleteProcedure(int id)
{
var obj = _procedureLogic.ReadElement(new ProcedureSearchModel { Id = id });
if (obj != null)
{
_procedureLogic.Delete(new ProcedureBindingModel { Id = obj.Id });
}
return RedirectToAction("Procedures");
}
public IActionResult CreateMedicament() public IActionResult CreateMedicament()
{ {
return View(); return View();

View File

@ -37,7 +37,7 @@
@foreach (var item in Model) @foreach (var item in Model)
{ {
<tr> <tr>
<td scope="row">@Html.DisplayFor(modelItem => item.Id)</td> <td scope="row">@item.Id</td>
<td>@item.Name</td> <td>@item.Name</td>
<td>@item.DateStartProcedure.ToShortDateString()</td> <td>@item.DateStartProcedure.ToShortDateString()</td>
<td>@item.DateStopProcedure?.ToShortDateString()</td> <td>@item.DateStopProcedure?.ToShortDateString()</td>
@ -50,13 +50,16 @@
</a> </a>
</td> </td>
<td> <td>
<a asp-action="DeleteProcedure"> <form method="post" asp-action="DeleteProcedure" asp-route-id="@item.Id">
<svg class="bi-cart-delete" viewBox="0 0 154 164" fill="none" xmlns="http://www.w3.org/2000/svg"> <button type="submit">
<path d="M44.5 123C4.99995 119.5 -11.8431 56.4293 24 19.5C40.5 2.50001 72.5 -5.5 101.5 27.5L115.5 14.5" stroke="#D10000" stroke-width="8" stroke-linecap="round" /> <svg class="bi-cart-delete" viewBox="0 0 154 164" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M65.2123 159.963L56 60.0001C88.0236 76.3307 119.521 77.4194 149 60.0001C141.63 142.346 140.08 160.953 140.226 159.963H65.2123Z" stroke="#D10000" stroke-width="8" /> <path d="M44.5 123C4.99995 119.5 -11.8431 56.4293 24 19.5C40.5 2.50001 72.5 -5.5 101.5 27.5L115.5 14.5" stroke="#D10000" stroke-width="8" stroke-linecap="round" />
<path d="M121 36L101.582 55L75 31" stroke="#D10000" stroke-width="8" stroke-linecap="round" /> <path d="M65.2123 159.963L56 60.0001C88.0236 76.3307 119.521 77.4194 149 60.0001C141.63 142.346 140.08 160.953 140.226 159.963H65.2123Z" stroke="#D10000" stroke-width="8" />
</svg> <path d="M121 36L101.582 55L75 31" stroke="#D10000" stroke-width="8" stroke-linecap="round" />
</a> </svg>
</button>
</form>
</td> </td>
</tr> </tr>