public async Task <ActionResult <PublicApi.v1.DTO.CategoryWithProductCount> > GetCategory(int id) { var category = await _bll.Categories.GetByIndexAndShop(id, User.GetShopId()); if (category == null) { return(NotFound()); } return(CategoryMapper.MapFromBLL(category)); }
public async Task <ActionResult <IEnumerable <PublicApi.v1.DTO.CategoryWithProductCount> > > GetCategories(string search, int?pageIndex, int?pageSize) { if ((pageIndex != null && pageIndex < 1) || (pageSize != null && pageSize < 1)) { return(BadRequest()); } var category = (await _bll.Categories.GetAllWithProductCountForShopAsync(User.GetShopId(), search, pageIndex, pageSize)) .Select(e => CategoryMapper.MapFromBLL(e)).ToList(); return(category); }