Esempio n. 1
0
        public virtual IActionResult Comments(int?filterByNewsItemId)
        {
            //try to get a news item with the specified id
            NewsItem newsItem = _newsService.GetNewsById(filterByNewsItemId ?? 0);

            if (newsItem == null && filterByNewsItemId.HasValue)
            {
                return(RedirectToAction("List"));
            }

            //prepare model
            NewsCommentSearchModel model = _newsModelFactory.PrepareNewsCommentSearchModel(new NewsCommentSearchModel(), newsItem);

            return(View(model));
        }
Esempio n. 2
0
        public virtual IActionResult NewsComments(int?filterByNewsItemId)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageNews))
            {
                return(AccessDeniedView());
            }

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

            if (newsItem == null && filterByNewsItemId.HasValue)
            {
                return(RedirectToAction("NewsComments"));
            }

            //prepare model
            var model = _newsModelFactory.PrepareNewsCommentSearchModel(new NewsCommentSearchModel(), newsItem);

            return(View(model));
        }