Esempio n. 1
0
 public IQueryable <DebtNoteViewModel> QueryableViewModel(DebtSearchingViewModel model)
 {
     if (model.to != null)
     {
         model.to = model.to.Value.AddDays(1);
     }
     return(Queryable().Where(x => ((x.Delete == false) &&
                                    ((!model.WarehouseId.HasValue) || (model.WarehouseId == x.PayWarehouse.Id)) &&
                                    ((!model.from.HasValue) || (DbFunctions.TruncateTime(x.CreatedDate) >= DbFunctions.TruncateTime(model.from))) &&
                                    ((!model.to.HasValue) || (DbFunctions.TruncateTime(x.CreatedDate) <= DbFunctions.TruncateTime(model.to)))))
            .Select(x => new DebtNoteViewModel
     {
         Id = x.Id,
         Code = x.Code,
         CreatedDate = x.CreatedDate,
         CreatedUser = x.User.UserName,
         PayMethod = x.PaymentType.Name,
         PayWarehouse = x.PayWarehouse.Name,
         LastModifiedDate = x.LastModifiedDate,
         PaymentTypeId = x.PaymentType.Id,
         WarehouseId = x.PayWarehouse.Id,
         isOwed = x.IsOwed,
         Noted = x.Noted,
         Total = x.Total
     }));
 }
Esempio n. 2
0
 public IEnumerable <DebtNoteViewModel> Get([FromUri] DebtSearchingViewModel model)
 {
     return(_debtNote.QueryableViewModel(model).ToList());
 }