Merge branch 'stage9_10' of https://git.is.ulstu.ru/ns.potapov/PIbd-21_CourseWork_Polyclinic_BeSick into stage9_10
This commit is contained in:
commit
25c1152969
@ -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,10 +55,53 @@ namespace PolyclinicWebAppSuretor.Controllers
|
||||
return View();
|
||||
}
|
||||
|
||||
public IActionResult CreateProcedure()
|
||||
[HttpGet]
|
||||
[HttpPost]
|
||||
public IActionResult CreateProcedure(string name, string? comment, DateTime dateStart, DateTime? dateStop)
|
||||
{
|
||||
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,
|
||||
DateStartProcedure = dateStart,
|
||||
DateStopProcedure = dateStop
|
||||
};
|
||||
_procedureLogic.Update(procedure);
|
||||
return RedirectToAction("Procedures");
|
||||
}
|
||||
}
|
||||
|
||||
public IActionResult CreateMedicament()
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
@using PolyclinicContracts.ViewModels
|
||||
@model List<ProcedureViewModel>
|
||||
@model ProcedureViewModel
|
||||
@{
|
||||
ViewData["Title"] = "CreateProcedure";
|
||||
}
|
||||
@ -10,40 +10,38 @@
|
||||
<form method="post" class="form-create-procedure d-flex flex-row justify-content-around align-items-center">
|
||||
|
||||
<div class="procedure-info d-flex flex-column mb-5 mt-5">
|
||||
|
||||
<input type="hidden" name="id" readonly asp-for="Id" />
|
||||
<div class="d-flex flex-row mb-5 flex-row justify-content-between align-items-center">
|
||||
<h3 class="col-3 m-3">
|
||||
Название:
|
||||
</h3>
|
||||
<input class="col-6" type="text" style="width: 45vh" />
|
||||
<input required type="text" id="name" name="name" asp-for="Name" />
|
||||
</div>
|
||||
|
||||
<div class="d-flex flex-row mb-5 flex-row justify-content-between align-items-center">
|
||||
<h3 class="col-3 m-3">
|
||||
Комментарий:
|
||||
</h3>
|
||||
<textarea class="col-6" id="comment" name="comment" style="width: 45vh">
|
||||
|
||||
<textarea type="text" id="comment" name="comment" asp-for="Comment" style="width: 45vh">
|
||||
</textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="d-flex flex-column mb-5 mt-5 justify-content-between align-content-around">
|
||||
<div class="mb-5 me-3">
|
||||
<label for="dateFrom" class="me-3">
|
||||
<label for="dateStart" class="me-3">
|
||||
Дата начала
|
||||
</label>
|
||||
<input type="date" id="dateFrom" name="dateFrom" />
|
||||
<input type="date" id="dateStart" name="dateStart" asp-for="DateStartProcedure" />
|
||||
</div>
|
||||
<div class="mb-5 me-3">
|
||||
<label for="dateTo" class="me-3">
|
||||
<label for="dateStop" class="me-3">
|
||||
Дата завершения
|
||||
</label>
|
||||
<input type="date" id="dateTo" name="dateTo" />
|
||||
<input type="date" id="dateStop" name="dateStop" asp-for="DateStopProcedure" />
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<input type="submit" value="Сохранить" class="button-save-procedure btn" asp-action="Procedures" />
|
||||
<input type="submit" value="Сохранить" class="button-save-procedure btn" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
@ -7,61 +7,41 @@
|
||||
<h1 class="display-4">Процедуры</h1>
|
||||
</div>
|
||||
|
||||
<div class="text-center">
|
||||
<div>
|
||||
@{
|
||||
// if (Model == null)
|
||||
// {
|
||||
// <h3 class="display-4">Авторизируйтесь</h3>
|
||||
// return;
|
||||
// }
|
||||
<div class="text-center">
|
||||
<p>
|
||||
<a asp-action="CreateProcedure">Создать процедуру</a>
|
||||
</p>
|
||||
</div>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
Номер
|
||||
</th>
|
||||
<th>
|
||||
Название процедуры
|
||||
</th>
|
||||
<th>
|
||||
Дата начала процедуры
|
||||
</th>
|
||||
<th>
|
||||
Дата окончания процедуры
|
||||
</th>
|
||||
<th>
|
||||
Комментарий
|
||||
</th>
|
||||
<th>
|
||||
Редактировать
|
||||
</th>
|
||||
<th>
|
||||
Удалить
|
||||
</th>
|
||||
<th scope="col">Номер</th>
|
||||
<th scope="col">Название процедуры</th>
|
||||
<th scope="col">Дата начала процедуры</th>
|
||||
<th scope="col">Дата окончания процедуры</th>
|
||||
<th scope="col">Комментарий</th>
|
||||
<th scope="col">Редактировать</th>
|
||||
<th scope="col">Удалить</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in Model)
|
||||
|
||||
|
||||
@foreach (var item in Model)
|
||||
{
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Id)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Name)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.DateStartProcedure)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.DateStopProcedure)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Comment)
|
||||
</td>
|
||||
<tr>
|
||||
<td scope="row">@Html.DisplayFor(modelItem => item.Id)</td>
|
||||
<td>@Html.DisplayFor(modelItem => item.Name)</td>
|
||||
<td>@Html.DisplayFor(modelItem => item.DateStartProcedure)</td>
|
||||
<td>@Html.DisplayFor(modelItem => item.DateStopProcedure)</td>
|
||||
<td>@Html.DisplayFor(modelItem => item.Comment)</td>
|
||||
<td>
|
||||
<a asp-action="CreateProcedure">
|
||||
<svg class="bi-edit-pen" viewBox="0 0 127 127" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
@ -76,7 +56,9 @@
|
||||
<path d="M121 36L101.582 55L75 31" stroke="#D10000" stroke-width="8" stroke-linecap="round" />
|
||||
</svg>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user