Пример #1
0
        public virtual IActionResult Comments(NewsCommentSearchModel searchModel)
        {
            //prepare model
            NewsCommentListModel model = _newsModelFactory.PrepareNewsCommentListModel(searchModel, searchModel.NewsItemId);

            return(Json(model));
        }
Пример #2
0
        public virtual IActionResult Comments(NewsCommentSearchModel searchModel)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageNews))
            {
                return(AccessDeniedDataTablesJson());
            }

            //prepare model
            var model = _newsModelFactory.PrepareNewsCommentListModel(searchModel, searchModel.NewsItemId);

            return(Json(model));
        }
Пример #3
0
        public virtual IActionResult Comments(NewsCommentSearchModel searchModel, int?filterByNewsItemId)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageNews))
            {
                return(AccessDeniedKendoGridJson());
            }

            //try to get a news item with the specified id
            var newsItem = _newsService.GetNewsById(filterByNewsItemId ?? 0);

            if (newsItem == null && filterByNewsItemId.HasValue)
            {
                throw new ArgumentException("No news item found with the specified id", nameof(filterByNewsItemId));
            }

            //prepare model
            var model = _newsModelFactory.PrepareNewsCommentListModel(searchModel, newsItem);

            return(Json(model));
        }