public IActionResponse <List <Transaction> > Get(TransactionSearchFilter filterModel) { var response = new ActionResponse <List <Transaction> >(); var q = _transaction.AsNoTracking().AsQueryable(); if (filterModel.OrderId != null) { q = q.Where(x => x.OrderId == filterModel.OrderId); } if (!string.IsNullOrWhiteSpace(filterModel.MobileNumber)) { long mobNum = 0; if (long.TryParse(filterModel.MobileNumber, out mobNum)) { q = q.Where(x => x.Order.User.MobileNumber == mobNum); } } if (filterModel.PaymentGatewayId != null) { q = q.Where(x => x.PaymentGatewayId == filterModel.PaymentGatewayId); } if (filterModel.Status != null) { q = q.Where(x => x.Status == filterModel.Status); } if (!string.IsNullOrWhiteSpace(filterModel.TrackingId)) { q = q.Where(x => x.TrackingId.Contains(filterModel.TrackingId)); } if (!string.IsNullOrWhiteSpace(filterModel.FromDateSh)) { q = q.Where(x => x.InsertDateSh.CompareTo(filterModel.FromDateSh) >= 0); } if (!string.IsNullOrWhiteSpace(filterModel.FromDateSh)) { q = q.Where(x => x.InsertDateSh.CompareTo(filterModel.ToDateSh) <= 0); } response.Result = q.OrderByDescending(x => x.TransactionId) .Take(filterModel.ItemsCount) .ToList(); return(response); }
public SearchTransaction(TransactionSearchFilter filter, PaginationFilter pageFilter, Guid userId) { this.Filter = filter; this.UserId = userId; this.PageFilter = pageFilter; }
public async Task <AggregateEnvelope> Report(TransactionSearchFilter filter, Guid userId) { var results = Compute(await queryBuilder.Query(userId, filter), filter.DateFilter); return(new AggregateEnvelope(filter.DateFilter, results)); }