Еще допиливаю
This commit is contained in:
parent
904264de3d
commit
0311309a63
@ -275,7 +275,7 @@ View(APIPharmacist.GetRequest<List<MedicineViewModel>>($"api/medicine/getmedicin
|
||||
Dictionary<int, IAnimalModel> a = new Dictionary<int, IAnimalModel>();
|
||||
foreach (int animal in animals)
|
||||
{
|
||||
a.Add(animal, new AnimalBindingModel { Id = animal } as IAnimalModel);
|
||||
a.Add(animal, new AnimalSearchModel { Id = animal } as IAnimalModel);
|
||||
}
|
||||
APIPharmacist.PostRequest("api/medicine/updatemedicine?isconnection=true", new MedicineBindingModel
|
||||
{
|
||||
@ -376,7 +376,7 @@ View(APIPharmacist.GetRequest<List<ServiceViewModel>>($"api/service/getservices?
|
||||
Dictionary<int, IMedicineModel> a = new Dictionary<int, IMedicineModel>();
|
||||
foreach (int medicine in medicines)
|
||||
{
|
||||
a.Add(medicine, new MedicineBindingModel { Id = medicine } as IMedicineModel);
|
||||
a.Add(medicine, new MedicineSearchModel { Id = medicine } as IMedicineModel);
|
||||
}
|
||||
|
||||
APIPharmacist.PostRequest("api/service/createservice", new ServiceBindingModel
|
||||
|
@ -11,7 +11,7 @@ namespace VetClinicDataBaseImplement
|
||||
{
|
||||
if (optionsBuilder.IsConfigured == false)
|
||||
{
|
||||
optionsBuilder.UseSqlServer(@"Data Source=localhost\SQLEXPRESS02;Initial Catalog=VetClinicDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
||||
optionsBuilder.UseSqlServer(@"Data Source=localhost\SQLEXPRESS;Initial Catalog=VetClinicDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
||||
}
|
||||
base.OnConfiguring(optionsBuilder);
|
||||
}
|
||||
|
@ -40,11 +40,15 @@ namespace VetClinicRestApi.Controllers
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public List<AnimalViewModel>? GetAnimalList(int adminId)
|
||||
public List<AnimalViewModel>? GetAnimalList(int? adminId = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
var res = _animal.ReadList(new AnimalSearchModel { AdminId = adminId });
|
||||
List<AnimalViewModel> res;
|
||||
if (!adminId.HasValue)
|
||||
res = _animal.ReadList(null);
|
||||
else
|
||||
res = _animal.ReadList(new AnimalSearchModel { AdminId = adminId });
|
||||
foreach (var animal in res)
|
||||
animal.VisitAnimals = null!;
|
||||
return res;
|
||||
|
@ -49,7 +49,7 @@ namespace VetClinicRestApi.Controllers
|
||||
else
|
||||
res = _medicine.ReadList(new MedicineSearchModel { PharmacistId = pharmacistId });
|
||||
foreach (var medicine in res)
|
||||
medicine.MedicineAnimals = null;
|
||||
medicine.MedicineAnimals = null!;
|
||||
return res;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -39,18 +39,22 @@ namespace VetClinicRestApi.Controllers
|
||||
}
|
||||
}
|
||||
[HttpGet]
|
||||
public List<VisitViewModel> GetVisits(int adminId)
|
||||
public List<VisitViewModel> GetVisits(int? adminId = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
var res = _visit.ReadList(new VisitSearchModel { AdminId = adminId });
|
||||
List<VisitViewModel> res;
|
||||
if (!adminId.HasValue)
|
||||
res = _visit.ReadList(null);
|
||||
else
|
||||
res = _visit.ReadList(new VisitSearchModel { AdminId = adminId });
|
||||
foreach (var visit in res)
|
||||
visit.ServiceVisits = null;
|
||||
visit.ServiceVisits = null!;
|
||||
return res;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка получения списка животного");
|
||||
_logger.LogError(ex, "Ошибка получения списка визитов");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user