"Стиль — это все. Это свежий взгляд на скучное и опасное. Стильные, но скучные лучше, чем опасные, но не стильные. Опасные и стильные — это искусство...Стиль есть не у всех, не все ему верны. "

— Чарльз Буковски
This commit is contained in:
goblinrf 2024-05-25 13:30:44 +04:00
parent 427b6f07b2
commit a3bdba6c2c
2 changed files with 19 additions and 7 deletions

View File

@ -166,7 +166,7 @@ View(APIAdmin.GetRequest<List<VaccinationViewModel>>($"api/vaccination/getvaccin
}
[HttpPost]
public void Create(string name, DateTime date)
public void Create(string name, DateTime date, List<int> services)
{
if (APIAdmin.Admin == null)
{
@ -176,11 +176,17 @@ View(APIAdmin.GetRequest<List<VaccinationViewModel>>($"api/vaccination/getvaccin
{
throw new Exception("Ошибка в введенных данных");
}
Dictionary<int, IServiceModel> a = new Dictionary<int, IServiceModel>();
foreach (int service in services)
{
a.Add(service, new ServiceSearchModel { Id = service } as IServiceModel);
}
APIAdmin.PostRequest("api/visit/createvisit", new VisitBindingModel
{
NameVisit = name,
DateVisit = date,
AdminId = APIAdmin.Admin.Id
AdminId = APIAdmin.Admin.Id,
ServiceVisits = a
});
Response.Redirect("Index");
}
@ -330,7 +336,7 @@ View(APIAdmin.GetRequest<List<VaccinationViewModel>>($"api/vaccination/getvaccin
}
[HttpPost]
public void Update(int visit, string name, DateTime date)
public void Update(int visit, string name, DateTime date, List<int> services)
{
if (APIAdmin.Admin == null)
{
@ -340,12 +346,18 @@ View(APIAdmin.GetRequest<List<VaccinationViewModel>>($"api/vaccination/getvaccin
{
throw new Exception("Ошибка в введенных данных");
}
Dictionary<int, IServiceModel> a = new Dictionary<int, IServiceModel>();
foreach (int service in services)
{
a.Add(service, new ServiceSearchModel { Id = service } as IServiceModel);
}
APIAdmin.PostRequest("api/visit/updatevisit", new VisitBindingModel
{
Id = visit,
NameVisit = name,
AdminId = APIAdmin.Admin.Id,
DateVisit = date,
ServiceVisits = a
});
Response.Redirect("Index");
}
@ -569,13 +581,13 @@ View(res);
return result;
}
[HttpGet]
public VaccinationViewModel GetVaccination(int adminId)
public VaccinationViewModel GetVaccination(int vaccinationId)
{
if (APIAdmin.Admin == null)
{
throw new Exception("Âû êàê ñþäà ïîïàëè? Ñþäà âõîä òîëüêî àâòîðèçîâàííûì");
}
var result = APIAdmin.GetRequest<VaccinationViewModel>($"api/vaccination/getvaccination?adminid={adminId}");
var result = APIAdmin.GetRequest<VaccinationViewModel>($"api/vaccination/getvaccination?vaccinationid={vaccinationId}");
if (result == null)
{
return default;

View File

@ -26,13 +26,13 @@
<div class="row">
<div class="col-4">Название:</div>
<div class="col-8">
<input type="text" name="name" />
<input type="text" id="name" name="name" />
</div>
</div>
<div class="row">
<div class="col-4">Цена:</div>
<div class="col-8">
<input type="text" name="cost" />
<input type="text" id="cost" name="cost" />
</div>
</div>
<div class="row">