//Support only one wallet for now. Search by userid instead. public JsonResult PendingList(int offset, int limit, AuthorizeTransactionPendingListSearchTerm searchField, string sort, string order) { if (!searchField.UserId.HasValue) { return(Json(new { }, JsonRequestBehavior.AllowGet)); } var queryableList = _financialService.GetAllWalletPendingPreauthorizeTransactionList(searchField.UserId.Value); var allRowCount = queryableList.Count(); //Filter reference number. if (searchField.ReferenceNo.IsNotNullOrEmpty()) { queryableList = queryableList.Where(x => x.ReferenceNo.Contains(searchField.ReferenceNo)); } //Filter transaction type. if (searchField.TransactionType.IsNotNullOrEmpty()) { queryableList = queryableList.Where(x => x.TransactionType == searchField.TransactionType); } if (!searchField.DateFrom.IsNullOrEmpty()) { DateTime date; DateTime.TryParseExact(searchField.DateFrom, DBCDateFormat.ddMMMyyyy, CultureInfo.CurrentCulture, DateTimeStyles.None, out date); if (date != null) { queryableList = queryableList.Where(x => x.TransactionDate >= date); } } if (!searchField.DateTo.IsNullOrEmpty()) { DateTime date; DateTime.TryParseExact(searchField.DateTo, DBCDateFormat.ddMMMyyyy, CultureInfo.CurrentCulture, DateTimeStyles.None, out date); if (date != null) { queryableList = queryableList.Where(x => x.TransactionDate <= date); } } if (searchField.StatusId.HasValue) { queryableList = queryableList.Where(x => x.StatusId == searchField.StatusId.Value); } queryableList = queryableList.PaginateList(x => x.TransactionDate, sort, order, offset, limit).OrderByDescending(x => x.TransactionDate); var rowsResult = queryableList.ToList().Select(x => new PreauthListViewModels { PreauthId = x.PreauthId.ToString(), TransactionDate = x.TransactionDate.ToUserLocalDateTime(User.Identity.GetUserTimeZone()), TransactionType = x.TransactionType, ReferenceNo = x.ReferenceNo, Debit = x.Debit.ToString(), Credit = x.Credit.ToString(), Status = x.Status.Description, ActionTags = new Func <List <ActionTag> >(() => { List <ActionTag> actions = new List <ActionTag>(); if (x.StatusId == (int)EStatus.Pending) { actions.Add(new ActionTag { Action = "authorize", Name = "Authorize" }); actions.Add(new ActionTag { Action = "void", Name = "Void" }); } return(actions); })() }); var model = new { total = allRowCount, rows = rowsResult }; return(Json(model, JsonRequestBehavior.AllowGet)); }