示例#1
0
        public IActionResult Catalog(int id, int?pageSize, int page = 1)
        {
            var catalog = new CatalogViewModel();

            if (pageSize == null)
            {
                pageSize = _configuration.GetValue <int>("PageSize");
            }

            catalog.Data      = _blogService.GetAllPaging(id, string.Empty, page, pageSize.Value);
            catalog.MostViews = _blogService.GetMostView(10);
            catalog.Category  = _blogCategoryService.GetById(id);
            return(View(catalog));
        }
        public IActionResult BlogCatalog(int id, int?pageSize, string sortBy, int page = 1)
        {
            var catalog = new BlogCatalogViewModel();

            ViewData["BodyClass"] = "";
            //if (pageSize == null)
            //    pageSize = _configuration.GetValue<int>("PageSize");

            catalog.PageSize     = pageSize;
            catalog.SortType     = sortBy;
            catalog.Data         = _blogService.GetAllPaging(id, string.Empty, page, pageSize.Value);
            catalog.BlogCategory = _blogCategoryService.GetById(id);

            return(View(catalog));
        }
示例#3
0
        public IActionResult GetById(int id)
        {
            var items = _blogCategoryService.GetById(id);

            if (items != null)
            {
                return(new OkObjectResult(items));
            }

            return(new OkResult());
        }
示例#4
0
        public async Task <IActionResult> GetById(int id)
        {
            var items = await _blogCategoryService.GetById(id);

            if (items != null)
            {
                return(new OkObjectResult(items));
            }

            return(new OkResult());
        }
示例#5
0
        public async Task <IActionResult> Catalog(int id, int?pageSize, string sortBy, int page = 1)
        {
            var request = new BlogRequest();
            var catalog = new BlogCategoryDisplayViewModel();

            ViewData["BodyClass"] = "shop_grid_full_width_page";
            request.PageSize      = pageSize ?? _configuration.GetValue <int>("PageSize");
            request.CategoryId    = id;
            catalog.PageSize      = request.PageSize;
            request.SortBy        = sortBy;
            request.PageIndex     = page;
            catalog.SortType      = sortBy;
            var data = await _blogService.GetAllPaging(request);

            catalog.Data     = data.Data;
            catalog.Category = await _blogCategoryService.GetById(id);

            return(View(catalog));
        }
示例#6
0
        public IActionResult GetById(int id)
        {
            var model = _blogCategoryService.GetById(id);

            return(new ObjectResult(model));
        }