Нашел баг, пофиксил баг
This commit is contained in:
parent
a3bdba6c2c
commit
a5591b68e4
@ -297,13 +297,13 @@ View(APIPharmacist.GetRequest<List<MedicineViewModel>>($"api/medicine/getmedicin
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public Tuple<MedicineViewModel, List<string>>? GetMedicine(int medicineId)
|
||||
public Tuple<MedicineViewModel, List<Tuple<string, int>>>? GetMedicine(int medicineId)
|
||||
{
|
||||
if (APIPharmacist.Pharmacist == null)
|
||||
{
|
||||
throw new Exception("Вы как сюда попали? Сюда вход только авторизованным");
|
||||
}
|
||||
var result = APIPharmacist.GetRequest<Tuple<MedicineViewModel, List<string>>>($"api/medicine/getmedicine?medicineid={medicineId}");
|
||||
var result = APIPharmacist.GetRequest<Tuple<MedicineViewModel, List<Tuple<string, int>>>>($"api/medicine/getmedicine?medicineid={medicineId}");
|
||||
if (result == null)
|
||||
{
|
||||
return default;
|
||||
@ -471,13 +471,13 @@ View(APIPharmacist.GetRequest<List<ServiceViewModel>>($"api/service/getservices?
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public Tuple<ServiceViewModel, List<string>>? GetService(int serviceId)
|
||||
public Tuple<ServiceViewModel, List<Tuple<string, int>>>? GetService(int serviceId)
|
||||
{
|
||||
if (APIPharmacist.Pharmacist == null)
|
||||
{
|
||||
throw new Exception("Âû êàê ñþäà ïîïàëè? Ñþäà âõîä òîëüêî àâòîðèçîâàííûì");
|
||||
}
|
||||
var result = APIPharmacist.GetRequest<Tuple<ServiceViewModel, List<string>>>($"api/service/getservice?serviceid={serviceId}");
|
||||
var result = APIPharmacist.GetRequest<Tuple<ServiceViewModel, List<Tuple<string,int>>>>($"api/service/getservice?serviceid={serviceId}");
|
||||
if (result == null)
|
||||
{
|
||||
return default;
|
||||
|
@ -22,7 +22,7 @@
|
||||
<select name="animals" class="form-control" multiple size="5" id="animals">
|
||||
@foreach (var animal in ViewBag.Animals)
|
||||
{
|
||||
<option value="@animal.Id" data-name="@animal.AnimalName">@animal.AnimalName</option>
|
||||
<option value="@animal.Id" data-name="@animal.Id">@animal.AnimalName</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
@ -50,7 +50,7 @@
|
||||
$('#price').val(result.item1.price);
|
||||
$.map(result.item2, function (n) {
|
||||
console.log("#" + n);
|
||||
$(`option[data-name=${n}]`).attr("selected", "selected")
|
||||
$(`option[data-name=${n.item2}]`).attr("selected", "selected")
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
<select name="medicines" class="form-control" multiple size="5" id="medicines">
|
||||
@foreach (var medicine in ViewBag.Medicines)
|
||||
{
|
||||
<option value="@medicine.Id" data-name="@medicine.MedicineName">@medicine.MedicineName</option>
|
||||
<option value="@medicine.Id" data-name="@medicine.Id">@medicine.MedicineName</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
@ -56,7 +56,7 @@
|
||||
$('#price').val(result.item1.price);
|
||||
$.map(result.item2, function ( n ) {
|
||||
console.log("#" + n);
|
||||
$(`option[data-name=${n}]`).attr("selected", "selected")
|
||||
$(`option[data-name=${n.item2}]`).attr("selected", "selected")
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -122,6 +122,7 @@ namespace VetClinicBusinessLogic.BusinessLogics
|
||||
if (used.Contains(visit.Id))
|
||||
continue;
|
||||
dict[medicine.Item1.Id].Visits.Add(visit);
|
||||
used.Add(visit.Id);
|
||||
}
|
||||
}
|
||||
ans.Add(dict[medicine.Item1.Id]);
|
||||
|
@ -11,7 +11,7 @@ namespace VetClinicDataBaseImplement
|
||||
{
|
||||
if (optionsBuilder.IsConfigured == false)
|
||||
{
|
||||
optionsBuilder.UseSqlServer(@"Data Source=localhost\SQLEXPRESS01;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);
|
||||
}
|
||||
|
@ -21,14 +21,14 @@ namespace VetClinicRestApi.Controllers
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public Tuple<MedicineViewModel, List<string>>? GetMedicine(int medicineId)
|
||||
public Tuple<MedicineViewModel, List<Tuple<string, int>>>? GetMedicine(int medicineId)
|
||||
{
|
||||
try
|
||||
{
|
||||
var elem = _medicine.ReadElement(new MedicineSearchModel { Id = medicineId });
|
||||
if (elem == null)
|
||||
return null;
|
||||
var res = Tuple.Create(elem, elem.MedicineAnimals.Select(x => x.Value.AnimalName).ToList());
|
||||
var res = Tuple.Create(elem, elem.MedicineAnimals.Select(x => Tuple.Create(x.Value.AnimalName, x.Value.Id)).ToList());
|
||||
res.Item1.MedicineAnimals = null!;
|
||||
return res;
|
||||
}
|
||||
|
@ -21,14 +21,14 @@ namespace VetClinicRestApi.Controllers
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public Tuple<ServiceViewModel, List<string>>? GetService(int serviceId)
|
||||
public Tuple<ServiceViewModel, List<Tuple<string,int>>>? GetService(int serviceId)
|
||||
{
|
||||
try
|
||||
{
|
||||
var elem = _service.ReadElement(new ServiceSearchModel { Id = serviceId });
|
||||
if (elem == null)
|
||||
return null;
|
||||
var res = Tuple.Create(elem, elem.ServiceMedicines.Select(x => x.Value.MedicineName).ToList());
|
||||
var res = Tuple.Create(elem, elem.ServiceMedicines.Select(x => Tuple.Create(x.Value.MedicineName, x.Value.Id)).ToList());
|
||||
res.Item1.ServiceMedicines = null!;
|
||||
return res;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user