public virtual async Task <ActionResult> Edit(int id)
        {
            var record = await _postCategoriesService.FindByIdAsync(id);

            ViewBag.EditorTitle = _localizationService.GetResource("Edit") + " (" + _localizationService.GetResource("Name") + ": " + record.CategoryName + ")";
            return(PartialView("Editor", await _postCategoriesModelFactory.PreparePostCategoryModelAsync(record)));
        }
Ejemplo n.º 2
0
        public virtual async Task <ActionResult> FilterByCategory(string slug, int?page, int?pageSize)
        {
            if (!CurrentSettings.EnableBlog)
            {
                return(View("PageNotFound"));
            }

            var category = await _categoriesService.FindBySlugAsync(slug);

            if (category == null && int.TryParse(slug, out int categoryId))
            {
                category = await _categoriesService.FindByIdAsync(categoryId);
            }

            if (category == null)
            {
                return(View("PageNotFound"));
            }

            return(View(new PostsExplorerModel()
            {
                CategoryName = category.GetLocalized(p => p.CategoryName),
                FilterByCategoryId = category.Id,
                PageIndex = page ?? 1,
                PageSize = pageSize
            }));
        }