From 49438bd93a5055aaa0471fe9f9221e11a3f78912 Mon Sep 17 00:00:00 2001 From: malimova Date: Thu, 25 Apr 2024 22:54:47 +0400 Subject: [PATCH] =?UTF-8?q?+=D0=B4=D0=B0=D0=BD=D0=BD=D1=8B=D0=B5=20=D0=B7?= =?UTF-8?q?=D0=B0=D0=BA=D0=B0=D0=B7=D0=B0=20=D0=B2=20=D0=BF=D0=B4=D1=84,?= =?UTF-8?q?=20=D0=BD=D0=BE=20=D0=BE=D0=BA=D0=B0=D0=B7=D0=B0=D0=BB=D0=BE?= =?UTF-8?q?=D1=81=D1=8C=20=D1=83=20=D0=BC=D0=B5=D0=BD=D1=8F=20=D0=B5=D1=89?= =?UTF-8?q?=D0=B5=20=D0=BC=D0=BD=D0=BE=D0=B3=D0=BE=20=D0=BE=D1=88=D0=B8?= =?UTF-8?q?=D0=B1=D0=BE=D0=BA=20=D0=BF=D0=BE=D1=8D=D1=82=D0=BE=D0=BC=D1=83?= =?UTF-8?q?=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0=D0=B5=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ConfectioneryDatabaseImplement/OrderStorage.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Confectionery/ConfectioneryDatabaseImplement/OrderStorage.cs b/Confectionery/ConfectioneryDatabaseImplement/OrderStorage.cs index f47bf75..1b26475 100644 --- a/Confectionery/ConfectioneryDatabaseImplement/OrderStorage.cs +++ b/Confectionery/ConfectioneryDatabaseImplement/OrderStorage.cs @@ -23,8 +23,11 @@ namespace ConfectioneryDatabaseImplement.Implements public List 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)