Compare commits

...

2 Commits

3 changed files with 10 additions and 3 deletions

View File

@ -29,7 +29,7 @@ namespace VeterinaryDatabaseImplement.Implements
{
using var context = new VeterinaryDatabase();
return context.Services.Include(x => x.Doctor).Include(x => x.Visit).Include(x => x.Medications)
return context.Services.Where(x => x.DoctorId == model.DoctorId).Include(x => x.Doctor).Include(x => x.Visit).Include(x => x.Medications)
.ThenInclude(x => x.Medication)
.Where(x => String.IsNullOrEmpty(model.ServiceName) || x.ServiceName.Contains(model.ServiceName))
.ToList()

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)
public void CreateService(string name, List<int> medications, int visit)
{
if (APIDoctor.Doctor == null)
{
@ -370,6 +370,7 @@ namespace VeterinaryShowDoctorApp.Controllers
{
ServiceName = name,
ServiceMedications = a,
VisitId = visit,
DoctorId = APIDoctor.Doctor.Id
});
Response.Redirect("Services");

View File

@ -12,6 +12,12 @@
<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">