Пример #1
0
        //-> GetList
        public async Task <GetListDTO <SourceSupplyViewDTO> > GetList(SourceSupplyFindDTO findDTO)
        {
            /*
             * IQueryable<tblSourceOfSupply> records = from x in db.tblSourceOfSupplies
             *                                      where x.deleted == null &&
             *                                      (string.IsNullOrEmpty(findDTO.name) ? 1 == 1 : x.name.Contains(findDTO.name))
             *                                      select x;
             * return await Listing(findDTO.currentPage, records.AsQueryable().OrderBy($"{findDTO.orderBy} {findDTO.orderDirection}"));
             */

            IQueryable <tblSourceOfSupply> query = db.tblSourceOfSupplies.Where(x => x.deleted == null);

            if (!string.IsNullOrEmpty(findDTO.name))
            {
                query = query.Where(x => x.name.StartsWith(findDTO.name));
            }
            query = query.AsQueryable().OrderBy($"{findDTO.orderBy} {findDTO.orderDirection}");

            return(await ListingHandler(findDTO.currentPage, query));
        }
 public async Task <ActionResult> Paging(SourceSupplyFindDTO findDTO)
 {
     return(PartialView(await handler.GetList(findDTO)));
 }