Merge branch 'main' of https://git.is.ulstu.ru/antic0der/PIbd-23_Nasyrov_A_Yunusov_N_CourseWork_Veterinary
This commit is contained in:
commit
ba99e0aa8b
@ -10,6 +10,7 @@ namespace VeterinaryContracts.SearchModels
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string? MedicationName { get; set; }
|
||||
public int DoctorId { get; set; }
|
||||
public int? DoctorId { get; set; }
|
||||
public double? Price { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ using VeterinaryContracts.BindingModels;
|
||||
using VeterinaryContracts.BusinessLogicContracts;
|
||||
using VeterinaryContracts.SearchModels;
|
||||
using VeterinaryContracts.ViewModels;
|
||||
using VeterinaryDatabaseImplement.Models;
|
||||
|
||||
namespace VeterinaryRestApi.Controllers
|
||||
{
|
||||
@ -52,6 +53,10 @@ namespace VeterinaryRestApi.Controllers
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach(var medication in model.DrugMedications)
|
||||
{
|
||||
model.Price += medication.Value.Price;
|
||||
}
|
||||
return _drug.Create(model);
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -203,7 +203,7 @@ namespace VeterinaryShowDoctorApp.Controllers
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
ViewBag.Medications = APIDoctor.GetRequest<List<MedicationViewModel>>($"api/medication/getmedications");
|
||||
ViewBag.Medications = APIDoctor.GetRequest<List<MedicationViewModel>>($"api/medication/getmedications?doctorid={APIDoctor.Doctor.Id}");
|
||||
|
||||
return View();
|
||||
}
|
||||
@ -215,7 +215,6 @@ namespace VeterinaryShowDoctorApp.Controllers
|
||||
{
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
}
|
||||
double _price=0;
|
||||
if (string.IsNullOrEmpty(name) || count <=0)
|
||||
{
|
||||
throw new Exception("Ошибка в введенных данных");
|
||||
@ -225,15 +224,10 @@ namespace VeterinaryShowDoctorApp.Controllers
|
||||
{
|
||||
a.Add(medication, new MedicationSearchModel { Id = medication } as IMedicationModel);
|
||||
}
|
||||
foreach (var elem in a)
|
||||
{
|
||||
_price += elem.Value.Price;
|
||||
}
|
||||
|
||||
APIDoctor.PostRequest("api/drug/createdrug", new DrugBindingModel
|
||||
{
|
||||
DrugName = name,
|
||||
Price = Math.Round(_price, 2),
|
||||
Price = 0,
|
||||
DrugMedications = a,
|
||||
Count = count
|
||||
});
|
||||
@ -329,7 +323,7 @@ namespace VeterinaryShowDoctorApp.Controllers
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View(APIDoctor.GetRequest<List<DrugViewModel>>($"api/service/getservices?doctorid={APIDoctor.Doctor.Id}"));
|
||||
return View(APIDoctor.GetRequest<List<ServiceViewModel>>($"api/service/getservices?doctorid={APIDoctor.Doctor.Id}"));
|
||||
|
||||
}
|
||||
public IActionResult CreateService()
|
||||
|
@ -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">
|
||||
<input type="text" name="price" id="price" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Количество:</div>
|
||||
<div class="col-8">
|
||||
|
@ -15,7 +15,7 @@
|
||||
<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>
|
||||
<select id="visit" name="visit" class="form-control" asp-items="@(new SelectList(@ViewBag.Visits, "Id", "VisitName"))"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
@ -9,7 +9,7 @@
|
||||
</div>
|
||||
<form method="post">
|
||||
<div class="row">
|
||||
<div class="col-4">Услуга:</div>
|
||||
<div class="col-4">Лекарство:</div>
|
||||
<div class="col-8">
|
||||
<select id="drug" name="drug" class="form-control" asp-items="@(new SelectList(@ViewBag.Drugs, "Id", "DrugName"))"></select>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user