Ejemplo n.º 1
0
        //-> GetList
        public async Task <GetListDTO <CheckLoanRequestViewDTO> > GetList(CheckLoanRequestFindDTO findDTO)
        {
            //--seem like search sql not dynamic -> should write one helper function or interface to do dynamic search
            IQueryable <tblAccount> accounts = from a in db.tblAccounts
                                               where a.acct_Deleted == null &&
                                               (string.IsNullOrEmpty(findDTO.name) ? 1 == 1 : a.acct_Name.Contains(findDTO.name)) &&
                                               (string.IsNullOrEmpty(findDTO.email) ? 1 == 1 : a.acct_Email.Contains(findDTO.email)) &&
                                               (string.IsNullOrEmpty(findDTO.status) ? 1 == 1 : a.acct_Status == findDTO.status)
                                               orderby a.acct_AccountID ascending
                                               select a;

            return(await Listing(findDTO.currentPage, accounts));
        }
 //->Paging
 public async Task <ActionResult> Paging(CheckLoanRequestFindDTO findDTO)
 {
     return(PartialView(await handler.GetList(findDTO)));
 }