This commit is contained in:
antoc0der 2024-05-23 21:43:55 +04:00
parent 47ab8f7e72
commit 6ba7695422
3 changed files with 24 additions and 1 deletions

View File

@ -3,6 +3,7 @@ using VeterinaryContracts.BindingModels;
using VeterinaryContracts.BusinessLogicContracts;
using VeterinaryContracts.SearchModels;
using VeterinaryContracts.ViewModels;
using VeterinaryDatabaseImplement.Models;
namespace VeterinaryRestApi.Controllers
{
@ -60,5 +61,18 @@ namespace VeterinaryRestApi.Controllers
throw;
}
}
[HttpGet]
public List<DoctorViewModel> GetDoctors()
{
try
{
return _logic.ReadList(null);
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка получения списка врачей");
throw;
}
}
}
}

View File

@ -221,11 +221,12 @@ namespace VeterinaryShowOwnerApp.Controllers
return Redirect("~/Home/Enter");
}
ViewBag.Pets = APIOwner.GetRequest<List<PetViewModel>>($"api/pet/getpets?ownerid={APIOwner.Owner.Id}");
ViewBag.Doctors = APIOwner.GetRequest<List<DoctorViewModel>>($"api/doctor/getdoctors");
return View();
}
[HttpPost]
public void CreateVisit(string name, List<int> pets, DateTime dateTime)
public void CreateVisit(string name, List<int> pets, DateTime dateTime, int doctor)
{
if (APIOwner.Owner == null)
{
@ -245,6 +246,8 @@ namespace VeterinaryShowOwnerApp.Controllers
VisitName = name,
VisitPet = a,
DateVisit = dateTime,
DoctorId = doctor,
OwnerId = APIOwner.Owner.Id,
});
Response.Redirect("Index");
}

View File

@ -18,6 +18,12 @@
<input type="datetime-local" id="datetime" name="datetime" />
</div>
</div>
<div class="row">
<div class="col-4">Врач:</div>
<div class="col-8">
<select id="doctor" name="doctor" class="form-control" asp-items="@(new SelectList(@ViewBag.Doctors, "Id", "DoctorFIO"))"></select>
</div>
</div>
<div class="row">
<div class="col-4">Животные:</div>
<div class="col-8">