ISEbd-22 Alimova M.S. Lab Work 04 base #5
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user