ISEbd-22 Alimova M.S. Lab Work 04 base #5

Closed
malimova wants to merge 20 commits from Lab4_base into Lab3_base
Showing only changes of commit 49438bd93a - Show all commits

View File

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