コード例 #1
0
        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));
        }
コード例 #2
0
        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);
        }