Ejemplo n.º 1
0
 public List <CustomerItemsModel> GetProductByCustomerId(int customerId, int statusId, DateTime?fromDate, DateTime?toDate)
 {
     using (var db = new EntityContext())
     {
         var source = _item.GetAll(db).Where(i => i.Customer.Id == customerId && i.Status.Id == statusId).ToList();
         if (fromDate != null)
         {
             source = source.Where(i => i.ReceiveDate >= fromDate).ToList();
         }
         if (toDate != null)
         {
             source = source.Where(i => i.ReceiveDate <= toDate).ToList();
         }
         var result = _item.AssignCustomerItemsList(source);
         return(result);
     }
 }