diff --git a/JewelryStoreDatabaseImplement/Implements/OrderStorage.cs b/JewelryStoreDatabaseImplement/Implements/OrderStorage.cs index a030f11..525a54b 100644 --- a/JewelryStoreDatabaseImplement/Implements/OrderStorage.cs +++ b/JewelryStoreDatabaseImplement/Implements/OrderStorage.cs @@ -8,6 +8,7 @@ using JewelryStoreContracts.SearchModels; using JewelryStoreContracts.StoragesContracts; using JewelryStoreContracts.ViewModels; using JewelryStoreDatabaseImplement.Models; +using Microsoft.EntityFrameworkCore; namespace JewelryStoreDatabaseImplement.Implements { @@ -44,14 +45,14 @@ namespace JewelryStoreDatabaseImplement.Implements public List GetFilteredList(OrderSearchModel model) { - if (!model.Id.HasValue) + if (!model.DateFrom.HasValue || ! model.DateTo.HasValue) { return new(); } using var context = new JewelryStoreDataBase(); - return context.Orders.Where(x => x.Id == model.Id).Select(x => x.GetViewModel).ToList(); + return context.Orders.Include(x => x.Jewel).Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo).Select(x => x.GetViewModel).ToList(); } public List GetFullList()