public ActionResult ViewTopic(int topicId, int?page) { var topicInfoViewModel = _topicReadService.GetTopicInfoViewModelById(topicId); topicInfoViewModel.PageNumber = page == null || page < 1 ? 1 : (int)page; return(View("ViewTopic/ViewTopic", topicInfoViewModel)); }
public JsonResult CheckNewPostPermissions(int topicId) { var userId = User.Identity.GetUserId <int>(); if (userId == 0) { return new JsonResult { Data = new { success = false, responseText = "You can't create post - You not authorized. Please, contact with administrator." } } } ; var topicInfoViewModel = _topicReadService.GetTopicInfoViewModelById(topicId); var permission = _permissionsService.UserHasPermissionByForumId(userId, topicInfoViewModel.ForumId, topicInfoViewModel.TopicClosed ? new List <string>() { CommonConstants.PostMessageInClosedTopic } : new List <string>() { CommonConstants.PostMessageInOpenTopic }); return(!permission ? new JsonResult { Data = new { success = false, responseText = "You can't create post in this topic. Please, contact with administrator." } } : new JsonResult { Data = new { success = true } }); }