This commit is contained in:
the
2023-05-24 21:14:10 +04:00
parent 343788051b
commit 93037d38db
9 changed files with 251 additions and 13 deletions

View File

@@ -30,11 +30,17 @@ namespace ComputerShopDatabaseImplement.Implements
public List<PurchaseViewModel> GetFilteredList(PurchaseSearchModel model)
{
if (!model.Id.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue && !model.ClientId.HasValue)
if (!model.Id.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue && !model.ClientId.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue)
{
return new();
}
using var context = new ComputerShopDatabase();
if (model.DateFrom.HasValue && model.DateTo.HasValue)
return context.Purchases
.Include(x => x.Component)
.Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo)
.Select(x => x.GetViewModel)
.ToList();
if (model.ClientId.HasValue)
{
return context.Purchases