Поправки по фильтрации
This commit is contained in:
parent
c34baa609e
commit
54c3ec41b0
@ -25,13 +25,13 @@ namespace HospitalDatabaseImplement.Implements
|
|||||||
|
|
||||||
public List<MedicineViewModel> GetFilteredList(MedicineSearchModel model)
|
public List<MedicineViewModel> GetFilteredList(MedicineSearchModel model)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(model.Name))
|
if (!model.ApothecaryId.HasValue)
|
||||||
{
|
{
|
||||||
return new();
|
return new();
|
||||||
}
|
}
|
||||||
using var context = new HospitalDatabase();
|
using var context = new HospitalDatabase();
|
||||||
return context.Medicines.Include(x => x.Apothecary)
|
return context.Medicines.Include(x => x.Apothecary)
|
||||||
.Where(x => x.Name.Contains(model.Name))
|
.Where(x => x.ApothecaryId == model.ApothecaryId)
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,8 @@ namespace HospitalDatabaseImplement.Implements
|
|||||||
}
|
}
|
||||||
using var context = new HospitalDatabase();
|
using var context = new HospitalDatabase();
|
||||||
return context.Prescriptions.Include(x => x.Apothecary).Include(x => x.Medicine)
|
return context.Prescriptions.Include(x => x.Apothecary).Include(x => x.Medicine)
|
||||||
.Where(x => x.Id == model.Id || x.ApothecaryId == model.ApothecaryId || (model.DateFrom <= x.Date && x.Date <= model.DateTo))
|
.Where(x => x.Id == model.Id || x.ApothecaryId == model.ApothecaryId
|
||||||
|
|| (model.DateFrom <= x.Date && x.Date <= model.DateTo)) // ищем либо по аптекарю, либо по периоду
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ namespace HospitalDatabaseImplement.Implements
|
|||||||
|
|
||||||
public List<RecipeViewModel> GetFilteredList(RecipeSearchModel model)
|
public List<RecipeViewModel> GetFilteredList(RecipeSearchModel model)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(model.Name) || !model.ApothecaryId.HasValue)
|
if (!model.ApothecaryId.HasValue)
|
||||||
{
|
{
|
||||||
return new();
|
return new();
|
||||||
}
|
}
|
||||||
@ -39,7 +39,7 @@ namespace HospitalDatabaseImplement.Implements
|
|||||||
.ThenInclude(x => x.Treatment)
|
.ThenInclude(x => x.Treatment)
|
||||||
.Include(x => x.Medicines)
|
.Include(x => x.Medicines)
|
||||||
.ThenInclude(x => x.Medicine)
|
.ThenInclude(x => x.Medicine)
|
||||||
.Where(x => x.Name.Contains(model.Name) || x.ApothecaryId == model.ApothecaryId)
|
.Where(x => x.ApothecaryId == model.ApothecaryId) // поиск по аптекарю
|
||||||
.ToList()
|
.ToList()
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
Loading…
Reference in New Issue
Block a user