コード例 #1
0
        public IHttpActionResult GetAllItemsForCategory(long categoryId, int page = Page, int pagesize = PageSize)
        {
            PagedResultsDto items;

            items = UserRole == Enums.RoleType.RestaurantAdmin.ToString() ? _itemFacade.GetAllItemsByCategoryId(Language, categoryId, page, pagesize) : _itemFacade.GetActivatedItemsByCategoryId(Language, categoryId, page, pagesize);

            //var items = _itemFacade.GetAllItemsByCategoryId(Language, categoryId, page, pagesize);
            var data = Mapper.Map <List <ItemModel> >(items.Data);

            foreach (var item in data)
            {
                item.ImageURL = Url.Link("ItemImage", new { item.RestaurantId, item.MenuId, item.CategoryId, item.ItemID });
            }
            return(PagedResponse("GetAllItemsForCategory", page, pagesize, items.TotalCount, data));
        }