From f41a3493b109754bd7de971b06355e9f1fc967f7 Mon Sep 17 00:00:00 2001 From: MaxKarme <91691525+MaxKarme@users.noreply.github.com> Date: Fri, 24 Mar 2023 21:34:48 +0400 Subject: [PATCH] database implements layers --- .../PizzeriaDatabaseImplement/Implements/OrderStorage.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Pizzeria/PizzeriaDatabaseImplement/Implements/OrderStorage.cs b/Pizzeria/PizzeriaDatabaseImplement/Implements/OrderStorage.cs index d5b4c63..54091c3 100644 --- a/Pizzeria/PizzeriaDatabaseImplement/Implements/OrderStorage.cs +++ b/Pizzeria/PizzeriaDatabaseImplement/Implements/OrderStorage.cs @@ -22,7 +22,12 @@ namespace PizzeriaDatabaseImplement.Implements { using var context = new PizzeriaDatabase(); return context.Orders - .Where(x => (model.Id.HasValue && x.Id == model.Id)) + .Where(x => ( + (!model.Id.HasValue || x.Id == model.Id) && + (!model.DateFrom.HasValue || x.DateCreate >= model.DateFrom) && + (!model.DateTo.HasValue || x.DateCreate <= model.DateTo) + ) + ) .Select(x => x.GetViewModel) .ToList(); }