public static object CreateCommentSortLinks(CommentToolsModel toolsModel, string sortType, bool reversed)
 {
     return(new
     {
         @Page = toolsModel.Page,
         @SortType = sortType,
         @Filter = toolsModel.Filter,
         @Search = toolsModel.Search,
         @Reversed = reversed,
         @id = toolsModel.Id
     });
 }
 public static object CreateCommentFilterLinks(CommentToolsModel toolsModel, string filter)
 {
     return(new
     {
         @Page = 1,
         @SortType = toolsModel.SortType,
         @Filter = filter,
         @Search = toolsModel.Search,
         @Reversed = toolsModel.Reversed,
         @id = toolsModel.Id
     });
 }
 public static object CreateCommentPageLinks(CommentToolsModel toolsModel, int pageOffset = 0)
 {
     return(new
     {
         @Page = toolsModel.Page + pageOffset,
         @SortType = toolsModel.SortType,
         @Filter = toolsModel.Filter,
         @Search = toolsModel.Search,
         @Reversed = toolsModel.Reversed,
         @id = toolsModel.Id
     });
 }
Exemplo n.º 4
0
        public static CommentViewModelCollection GenerateCommentViewModelCollection(CommentToolsModel options)
        {
            var newsPostService = NewsPostHelper.NewsPostService;
            var optionsBusiness = options.ConvertToOptionsCollectionById();
            var comments        = CommentService.GetCommentsWithTools(optionsBusiness);

            int commentsCount = optionsBusiness.ItemsCount;

            var commentsViewModel = new List <CommentViewModel>();

            foreach (Comment comment in comments)
            {
                commentsViewModel.Add(new CommentViewModel(comment));
            }
            options.Pages = optionsBusiness.Pages;
            var    newsPost  = newsPostService.GetNewsPost(options.Id);
            string imagePath = FileModelActions.GetNameByIdFormated(newsPost.ImageId);

            return(new CommentViewModelCollection(newsPost, imagePath, commentsViewModel, options, commentsCount));
        }
Exemplo n.º 5
0
 public CommentViewModelCollection(NewsPost newsPost, string imagePath, ICollection <CommentViewModel> commentViewModels, CommentToolsModel toolBar, int commentsCount) : base(toolBar)
 {
     CommentViewModels = commentViewModels;
     CommentsCount     = commentsCount;
     NewsPost          = newsPost;
     ImagePath         = imagePath;
     Page++;
 }
Exemplo n.º 6
0
        public ActionResult Comments(CommentToolsModel commentTools)
        {
            var commentViewModelCollection = CommentHelper.GenerateCommentViewModelCollection(commentTools);

            return(View(commentViewModelCollection));
        }