+данные заказа в пдф, но оказалось у меня еще много ошибок поэтому работаем

This commit is contained in:
malimova 2024-04-25 22:54:47 +04:00
parent aec779bd99
commit 49438bd93a

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)