привязка епта

This commit is contained in:
antoc0der 2024-05-27 01:09:37 +04:00
parent 2da1360f8a
commit 3f46e712a0
4 changed files with 37 additions and 12 deletions

View File

@ -143,9 +143,9 @@ namespace VeterinaryDatabaseImplement.Migrations
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
OwnerId = table.Column<int>(type: "int", nullable: false),
DrugId = table.Column<int>(type: "int", nullable: false),
DrugId = table.Column<int>(type: "int", nullable: true),
Count = table.Column<int>(type: "int", nullable: false),
Sum = table.Column<double>(type: "float", nullable: false),
Sum = table.Column<double>(type: "float", nullable: true),
DateCreate = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
@ -199,7 +199,7 @@ namespace VeterinaryDatabaseImplement.Migrations
.Annotation("SqlServer:Identity", "1, 1"),
ServiceName = table.Column<string>(type: "nvarchar(max)", nullable: false),
DoctorId = table.Column<int>(type: "int", nullable: false),
VisitId = table.Column<int>(type: "int", nullable: false)
VisitId = table.Column<int>(type: "int", nullable: true)
},
constraints: table =>
{

View File

@ -345,12 +345,12 @@ namespace VeterinaryShowDoctorApp.Controllers
return Redirect("~/Home/Enter");
}
ViewBag.Medications = APIDoctor.GetRequest<List<MedicationViewModel>>($"api/medication/getmedications?doctorid={APIDoctor.Doctor.Id}");
ViewBag.Visits = APIDoctor.GetRequest<List<VisitViewModel>>($"api/visit/getallvisits");
//ViewBag.Visits = APIDoctor.GetRequest<List<VisitViewModel>>($"api/visit/getallvisits");
return View();
}
[HttpPost]
public void CreateService(string name, List<int> medications, int visit)
public void CreateService(string name, List<int> medications)
{
if (APIDoctor.Doctor == null)
{
@ -370,7 +370,6 @@ namespace VeterinaryShowDoctorApp.Controllers
{
ServiceName = name,
ServiceMedications = a,
VisitId = visit,
DoctorId = APIDoctor.Doctor.Id
});
Response.Redirect("Services");

View File

@ -12,12 +12,6 @@
<input type="text" name="name" id="name" />
</div>
</div>
<div class="row">
<div class="col-4">Визиты:</div>
<div class="col-8">
<select id="visit" name="visit" class="form-control" asp-items="@(new SelectList(@ViewBag.Visits, "Id", "VisitName"))"></select>
</div>
</div>
<div class="row">
<div class="col-4">Медикаменты:</div>
<div class="col-8">

View File

@ -0,0 +1,32 @@
@using VeterinaryContracts.ViewModels;
@{
ViewData["Title"] = "VisitServiceBundle";
}
<div class="text-center">
<h2 class="display-4">Редактирование услуги</h2>
</div>
<form method="post">
<div class="row">
<div class="col-4">Посещение:</div>
<div class="col-8">
<select id="service" name="service" class="form-control" asp-items="@(new SelectList(@ViewBag.Services, "Id", "ServiceName"))"></select>
</div>
</div>
<div class="row">
<div class="col-4">Услуги:</div>
<div class="col-8">
<select name="services" class="form-control" multiple size="5" id="services">
@foreach (var service in ViewBag.Services)
{
<option value="@service.Id" data-name="@service.Id">@service.ServiceName</option>
}
</select>
</div>
</div>
<div class="row">
<div class="col-8"></div>
<div class="col-4"><input type="submit" value="Сохранить" class="btn btn-primary" /></div>
</div>
</form>