public static List <AuthorizationVM> FilterRequestDetails(FilterAuthorizationVM request) { using (var db = new SoneriCISEntities()) { var _query = new List <AuthorizationVM>(); var query = db.tbl_Requests.Where(e => e.IsActive == true && e.AuthorizationStatus == "R" && e.RequestType == request.RequestType).AsEnumerable(); if (request.From != null) { query = query.Where(a => a.RequestDate >= request.From); } if (request.To != null) { query = query.Where(a => a.RequestDate <= request.To); } if (request.CIFNumber != null) { query = query.Where(a => a.CIFNo == request.CIFNumber); } if (request.AccountNumber != null) { query = query.Where(a => a.AccountNo == request.AccountNumber); } if (request.RequestNumber != null) { query = query.Where(a => a.ID == request.RequestNumber); } _query = query.Select(o => new AuthorizationVM { ID = o.ID, AccountNo = o.AccountNo, CardNo = o.CardNo, CardTitle = o.CardTitle, CardTypeID = o.CardTypeID, CIFNo = o.CIFNo, RequestDate = o.RequestDate, RequestType = o.RequestType, WaiveCharges = o.WaiveCharges, AuthorizationComments = o.AuthorizationComments }).ToList(); _query.ForEach(e => e.CardType = db.tbl_Card_Types.FirstOrDefault(o => o.ID == e.CardTypeID && o.IsActive == true)); return(_query); } }
public ActionResult FilterAuthorizeScreen(FilterAuthorizationVM request) { List <AuthorizationVM> viewModel = ReviewMethods.FilterRequestDetails(request); return(PartialView("_partialReviewAuthorizeView", viewModel)); }