Exemple #1
0
        public async Task <List <ListLocationPostViewModel> > ExecuteAsync(int typeCategory, int page, int pageSize, string nameLocation)
        {
            var getAllByLocation = await _filterAllPagingPostServiceQuery.
                                   ExecuteAsync(1, 0, KindOfDetailService.FILTER_BY_LOCATION, nameLocation);

            var groupByCategory = getAllByLocation.Results.GroupBy(x => new
            {
                x.CategoryId,
                x.CategoryName
            }).Select(x => new ListLocationPostViewModel
            {
                CategoryName = x.Key.CategoryName,
                CategoryId   = x.Key.CategoryId,
                ListService  = pageSize == 0 ? x.ToList() : x.Skip((page - 1) * pageSize).Take(pageSize).ToList()
            }).ToList();

            if (typeCategory != 0)
            {
                groupByCategory.Where(x => x.CategoryId == typeCategory);
            }
            return(groupByCategory);
        }
Exemple #2
0
        public async Task <IActionResult> GetFilterAllPaging(int page, int pageSize, string typeFilter, string filterName)
        {
            var model = await _filterAllPagingPostServiceQuery.ExecuteAsync(page, pageSize, typeFilter, filterName);

            return(new OkObjectResult(model));
        }