Example #1
0
        public PagedResultDto <CapPhatDto> GetCapPhats(CapPhatFilter input)
        {
            var query = capPhatrepository.GetAll().Where(x => !x.IsDelete);

            // filter by value
            if (input.TenDonVi != null)
            {
                query = query.Where(x => x.TenDonVi.ToLower().Equals(input.TenDonVi));
            }

            var totalCount = query.Count();

            // sorting
            if (!string.IsNullOrWhiteSpace(input.Sorting))
            {
                query = query.OrderBy(input.Sorting);
            }

            // paging
            var items = query.PageBy(input).ToList();

            // result
            return(new PagedResultDto <CapPhatDto>(
                       totalCount,
                       items.Select(item => ObjectMapper.Map <CapPhatDto>(item)).ToList()));
        }
Example #2
0
 public PagedResultDto <CapPhatDto> GetCapPhatsByFilter(CapPhatFilter CapPhatFilter)
 {
     return(capPhatAppservice.GetCapPhats(CapPhatFilter));
 }