Еще правки
This commit is contained in:
parent
0311309a63
commit
2f2f6aa4bc
@ -490,7 +490,7 @@ View(APIPharmacist.GetRequest<List<ServiceViewModel>>($"api/service/getservices?
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
var res = APIPharmacist.GetRequest<List<GuidanceViewModel>>($"api/guidance/getguidances");
|
||||
var res = APIPharmacist.GetRequest<List<GuidanceViewModel>>($"api/guidance/getguidances?pharmacistid={APIPharmacist.Pharmacist.Id}");
|
||||
return
|
||||
View(res);
|
||||
|
||||
@ -499,7 +499,7 @@ View(res);
|
||||
[HttpGet]
|
||||
public IActionResult CreateGuidance()
|
||||
{
|
||||
ViewBag.Services = APIPharmacist.GetRequest<List<ServiceViewModel>>("api/service/getservices");
|
||||
ViewBag.Services = APIPharmacist.GetRequest<List<ServiceViewModel>>($"api/service/getservices?pharmacistid={APIPharmacist.Pharmacist.Id}");
|
||||
return View();
|
||||
}
|
||||
[HttpPost]
|
||||
@ -524,8 +524,8 @@ View(res);
|
||||
[HttpGet]
|
||||
public IActionResult UpdateGuidance()
|
||||
{
|
||||
ViewBag.Services = APIPharmacist.GetRequest<List<ServiceViewModel>>("api/service/getservices");
|
||||
ViewBag.Guidances = APIPharmacist.GetRequest<List<GuidanceViewModel>>($"api/guidance/getguidances");
|
||||
ViewBag.Services = APIPharmacist.GetRequest<List<ServiceViewModel>>($"api/service/getservices?pharmacistid={APIPharmacist.Pharmacist.Id}");
|
||||
ViewBag.Guidances = APIPharmacist.GetRequest<List<GuidanceViewModel>>($"api/guidance/getguidances?pharmacistid={APIPharmacist.Pharmacist.Id}");
|
||||
return View();
|
||||
}
|
||||
[HttpPost]
|
||||
@ -552,7 +552,7 @@ View(res);
|
||||
[HttpGet]
|
||||
public IActionResult DeleteGuidance()
|
||||
{
|
||||
ViewBag.Guidances = APIPharmacist.GetRequest<List<GuidanceViewModel>>($"api/guidance/getguidances");
|
||||
ViewBag.Guidances = APIPharmacist.GetRequest<List<GuidanceViewModel>>($"api/guidance/getguidances?pharmacistid={APIPharmacist.Pharmacist.Id}");
|
||||
return View();
|
||||
}
|
||||
|
||||
|
@ -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" id="@animal.AnimalName">@animal.AnimalName</option>
|
||||
<option value="@animal.Id" data-name="@animal.AnimalName">@animal.AnimalName</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
@ -50,7 +50,7 @@
|
||||
$('#price').val(result.item1.price);
|
||||
$.map(result.item2, function (n) {
|
||||
console.log("#" + n);
|
||||
$("#" + n).attr("selected", "selected")
|
||||
$(`option[data-name=${n}]`).attr("selected", "selected")
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ btn-primary" />
|
||||
success: function (result) {
|
||||
console.log(result.item2);
|
||||
$('#text').val(result.text);
|
||||
$("#" + result.serviceId).attr("selected", "selected")
|
||||
$(`option[data-name=${result.serviceId}]`).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" id="@medicine.MedicineName">@medicine.MedicineName</option>
|
||||
<option value="@medicine.Id" data-name="@medicine.MedicineName">@medicine.MedicineName</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
@ -56,7 +56,7 @@
|
||||
$('#price').val(result.item1.price);
|
||||
$.map(result.item2, function ( n ) {
|
||||
console.log("#" + n);
|
||||
$("#" + n).attr("selected", "selected")
|
||||
$(`option[data-name=${n}]`).attr("selected", "selected")
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -10,6 +10,7 @@ namespace VetClinicContracts.SearchModels
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string? Text { get; set; }
|
||||
public int? PharmacistId { get; set; }
|
||||
public DateTime? DateFrom { get; set; }
|
||||
public DateTime? DateTo { get; set; }
|
||||
public int? ServiceId { get; set; }
|
||||
|
@ -25,7 +25,7 @@ namespace VetClinicDataBaseImplement.Implements
|
||||
using var context = new VetClinicDatabase();
|
||||
return context.Guidances.Include(x => x.Service).Where(x => (!model.Id.HasValue || model.Id == x.Id)
|
||||
&& (!model.ServiceId.HasValue || model.ServiceId == x.ServiceId) && (!model.DateFrom.HasValue || model.DateFrom <= x.Date)
|
||||
&& (!model.DateTo.HasValue || model.DateTo >= x.Date))
|
||||
&& (!model.DateTo.HasValue || model.DateTo >= x.Date) && (!model.PharmacistId.HasValue || model.PharmacistId == x.Service.PharmacistId))
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
@ -36,20 +36,20 @@ namespace VetClinicRestApi.Controllers
|
||||
}
|
||||
}
|
||||
[HttpGet]
|
||||
public List<GuidanceViewModel>? GetGuidances(int? serviceId = null)
|
||||
public List<GuidanceViewModel>? GetGuidances(int? pharmacistId = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!serviceId.HasValue)
|
||||
if (!pharmacistId.HasValue)
|
||||
return _guidance.ReadList(null);
|
||||
return _guidance.ReadList(new GuidanceSearchModel
|
||||
{
|
||||
ServiceId = serviceId
|
||||
PharmacistId = pharmacistId
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка получения списка рекомендааций услуги id ={ Id}", serviceId);
|
||||
_logger.LogError(ex, "Ошибка получения списка рекомендааций пользователя id ={ Id}", pharmacistId);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user