Лабораторная_4

This commit is contained in:
yuliya.mavrina@internet.ru 2024-04-26 08:42:39 +03:00
parent 83b16975a4
commit 645181dc4b

View File

@ -23,9 +23,14 @@ namespace RenovationWorkDatabaseImplement.Implements
public List<OrderViewModel> GetFilteredList(OrderSearchModel model) public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
{ {
using var context = new RenovationWorkDatabase(); using var context = new RenovationWorkDatabase();
var result = context.Orders.Include(x => x.Repair).Select(x => x.GetViewModel).ToList(); if (model.DateFrom.HasValue)
return result; {
} return context.Orders.Include(x => x.Repair).Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo).Select(x => x.GetViewModel).ToList();
}
return context.Orders.Include(x => x.Repair).Where(x => x.Id == model.Id).Select(x => x.GetViewModel).ToList();
//var result = context.Orders.Include(x => x.Repair).Select(x => x.GetViewModel).ToList();
// return result;
}
public OrderViewModel? GetElement(OrderSearchModel model) public OrderViewModel? GetElement(OrderSearchModel model)
{ {