pdf 3
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user