Пример #1
0
        public static void DeleteNewsPost(int id, HttpServerUtilityBase server)
        {
            var newsPost = NewsPostService.GetNewsPost(id);

            NewsPostService.DeleteNewsPost(id);
            FileModelActions.RemoveFile(newsPost.ImageId, server);
        }
Пример #2
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));
        }