Ejemplo n.º 1
0
        public ActionResult RelatedPostAddPopup(int postId)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManagePosts))
            {
                return(AccessDeniedView());
            }

            var model = new PostModel.AddRelatedPostModel();

            //categories
            model.AvailableCategories.Add(new SelectListItem
            {
                Text  = _localizationService.GetResource("Admin.Common.All"),
                Value = "0"
            });
            var categories = _categoryService.GetAllCategories(showHidden: true);

            foreach (var c in categories)
            {
                model.AvailableCategories.Add(new SelectListItem
                {
                    Text  = c.GetFormattedBreadCrumb(categories),
                    Value = c.Id.ToString()
                });
            }

            return(View(model));
        }
Ejemplo n.º 2
0
        public ActionResult RelatedPostAddPopupList(DataSourceRequest command, PostModel.AddRelatedPostModel model)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManagePosts))
            {
                return(AccessDeniedView());
            }


            var posts = _postService.SearchPosts(
                categoryIds: new List <int> {
                model.SearchCategoryId
            },
                keywords: model.SearchPostName,
                pageIndex: command.Page - 1,
                pageSize: command.PageSize,
                showHidden: true
                );
            var gridModel = new DataSourceResult();

            gridModel.Data  = posts.Select(x => x.ToModel());
            gridModel.Total = posts.TotalCount;

            return(Json(gridModel));
        }