поправила медикаменты - круды для них работают

This commit is contained in:
Елена Бакальская 2024-05-28 21:53:46 +04:00
parent 7eb6e50cd6
commit 9d840a764e
4 changed files with 30 additions and 27 deletions

View File

@ -99,10 +99,6 @@ namespace PolyclinicBusinessLogic.BusinessLogics
{
throw new ArgumentNullException("Какой-то неправильный идентификатор процедуры...", nameof(model));
}
if (string.IsNullOrEmpty(model.Comment))
{
throw new ArgumentNullException("Нет комментария", nameof(model.Comment));
}
if (string.IsNullOrEmpty(model.Name))
{
throw new ArgumentNullException("Нет названия у препарата", nameof(model.Comment));

View File

@ -40,6 +40,8 @@ namespace PolyclinicDatabaseImplement.Models
{
Name = bindingModel.Name;
Comment = bindingModel.Comment;
ProcedureId = bindingModel.ProcedureId;
SymptomId = bindingModel.SymptomId;
}
public MedicamentViewModel GetViewModel => new()

View File

@ -171,6 +171,8 @@ namespace PolyclinicWebAppSuretor.Controllers
[HttpPost]
public IActionResult EditMedicament(MedicamentViewModel model)
{
ViewBag.Procedures = _procedureLogic.ReadList(null);
ViewBag.Symptomes = _symptomLogic.ReadList(null);
if (HttpContext.Request.Method == "GET")
{
var obj = _medicamentLogic.ReadElement(new MedicamentSearchModel { Id = model.Id });

View File

@ -43,33 +43,36 @@
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<td>@item.Id</td>
<td>@item.Name</td>
<td>@item.SymptomName</td>
<td>@item.ProcedureName</td>
<td>@item.Comment</td>
<td>
<a asp-action="EditMedicament" asp-route-id="@item.Id">
<svg class="bi-edit-pen" viewBox="0 0 127 127" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M105.5 26L37 114.5C34.5 117 16.3 121.7 7.5 122.5C79.1 34.1 101 5.5 102 4C104.833 4.5 119.3 14.6 122.5 21C105 44 98.5 55 111.5 58.5" stroke="#008315" stroke-width="6" stroke-linecap="round" />
</svg>
</a>
</td>
<td>
<form method="post" asp-action="DeleteMedicament" asp-route-id="@item.Id">
<button class="btn" type="submit">
<svg class="bi-cart-delete" viewBox="0 0 154 164" fill="none" xmlns="http://www.w3.org/2000/svg">
<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="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="M121 36L101.582 55L75 31" stroke="#D10000" stroke-width="8" stroke-linecap="round" />
</svg>
</button>
<tr>
<td>@item.Id</td>
<td>@item.Name</td>
<td>@item.SymptomName</td>
<td>@item.ProcedureName</td>
<td>@item.Comment</td>
<td>
<a asp-action="EditMedicament" asp-route-id="@item.Id">
<svg class="bi-edit-pen" viewBox="0 0 127 127" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M105.5 26L37 114.5C34.5 117 16.3 121.7 7.5 122.5C79.1 34.1 101 5.5 102 4C104.833 4.5 119.3 14.6 122.5 21C105 44 98.5 55 111.5 58.5" stroke="#008315" stroke-width="6" stroke-linecap="round" />
</svg>
</a>
</td>
<td>
<form method="post" asp-action="DeleteMedicament" asp-route-id="@item.Id">
<button class="btn" type="submit">
<svg class="bi-cart-delete" viewBox="0 0 154 164" fill="none" xmlns="http://www.w3.org/2000/svg">
<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="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="M121 36L101.582 55L75 31" stroke="#D10000" stroke-width="8" stroke-linecap="round" />
</svg>
</button>
</form>
</form>
</td>
</td>
</tr>
}
</tbody>
</table>