И еще выборки для отчета

This commit is contained in:
gg12 darfren 2024-05-02 14:39:44 +04:00
parent b508661bac
commit 0f1f2d4f18
4 changed files with 6 additions and 2 deletions

View File

@ -11,5 +11,6 @@ namespace VetClinicContracts.SearchModels
public int? Id { get; set; }
public string? ServiceName { get; set; } = string.Empty;
public int? PharmacistId { get; set; }
public int? MedicineId { get; set; }
}
}

View File

@ -16,5 +16,6 @@ namespace VetClinicContracts.SearchModels
public string? DateVisit { get; set; }
public DateTime? DateFrom { get; set; }
public DateTime? DateTo { get; set; }
public int? ServiceId { get; set; }
}
}

View File

@ -32,7 +32,8 @@ namespace VetClinicDataBaseImplement.Implements
.Include(x => x.Medicines)
.ThenInclude(x => x.Medicine)
.Where(x => (string.IsNullOrEmpty(model.ServiceName) || x.ServiceName.Contains(model.ServiceName))
&& (!model.PharmacistId.HasValue || x.PharmacistId == model.PharmacistId))
&& (!model.PharmacistId.HasValue || x.PharmacistId == model.PharmacistId)
&& (!model.MedicineId.HasValue || x.Medicines.Select(x => x.MedicineId).ToList().Contains(model.MedicineId.Value)))
.ToList()
.Select(x => x.GetViewModel)
.ToList();

View File

@ -33,7 +33,8 @@ namespace VetClinicDataBaseImplement.Implements
return context.Visits.Include(x => x.Admin).Include(x => x.Services)
.ThenInclude(x => x.Service)
.Where(x => (string.IsNullOrEmpty(model.NameVisit) || x.NameVisit.Contains(model.NameVisit))
&& (!model.AdminId.HasValue || x.AdminId == model.AdminId))
&& (!model.AdminId.HasValue || x.AdminId == model.AdminId)
&& (!model.ServiceId.HasValue || x.Services.Select(x => x.ServiceId).ToList().Contains(model.ServiceId.Value)))
.Select(x => x.GetViewModel)
.ToList();
}