Ejemplo n.º 1
0
        public ActionResult ApproveComment(int commentId)
        {
            var ops = OperationsFactory.CreateCommentOps();

            ops.ApproveComment(commentId, 2);

            return(RedirectToAction("PendingApproval", "PendingApproval"));
        }
Ejemplo n.º 2
0
 public ActionResult DeleteComment(int id)
 {
     try
     {
         var ops = OperationsFactory.CreateCommentOps();
         ops.DeleteComment(id);
         return(RedirectToAction("PendingApproval", "PendingApproval"));
     }
     catch
     {
         return(RedirectToAction("PendingApproval", "PendingApproval"));
     }
 }
Ejemplo n.º 3
0
        public ActionResult PostNewComment(SingleBlogPostVM model)
        {
            var ops = OperationsFactory.CreateCommentOps();

            model.NewComment.DateOfComment = DateTime.Now;
            model.NewComment.Status        = new Status()
            {
                StatusID = 1
            };
            ops.CreateComment(model.NewComment);

            return(RedirectToAction("ShowSinglePost", new { id = model.NewComment.BlogPostID }));
        }
Ejemplo n.º 4
0
        public ActionResult ShowSinglePost(int id)
        {
            var ops        = OperationsFactory.CreateBlogPostOps();
            var commentOps = OperationsFactory.CreateCommentOps();

            var singlePostVM = new SingleBlogPostVM()
            {
                NewComment = new Comment()
            };

            singlePostVM.SelectedBlogPost = ops.GetBlogPostById(id);
            singlePostVM.Comments         = commentOps.GetAllCommentsByBlogPostID(id).FindAll(x => x.Status.StatusID == 2);
            return(View(singlePostVM));
        }
Ejemplo n.º 5
0
        public ActionResult PendingApproval()
        {
            var model = new ApprovalVM()
            {
                SelectedBlogPost = new BlogPost()
            };
            var blogPostOps = OperationsFactory.CreateBlogPostOps();
            var statusOps   = OperationsFactory.CreateStatusOps();
            var commentOps  = OperationsFactory.CreateCommentOps();

            model.ListOfPosts          = blogPostOps.GetAllBlogPosts().FindAll(x => x.Status.StatusID == 1);
            model.RejectedPostsList    = blogPostOps.GetAllBlogPosts().FindAll(x => x.Status.StatusID == 3);
            model.DraftedPosts         = blogPostOps.GetAllBlogPosts().FindAll(x => x.Status.StatusID == 5);
            model.ScheduledPosts       = blogPostOps.GetAllBlogPosts().FindAll(x => x.Status.StatusID == 6 || x.DateOfPost > DateTime.Today);
            model.CommentsToBeApproved = commentOps.GetAllComments().FindAll(x => x.Status.StatusID == 1);
            var statusList = statusOps.ListAllStatuses();

            model.GenerateStatusList(statusList);

            return(View(model));
        }
Ejemplo n.º 6
0
        public void CreateCommentFailedDateTimeDBTest()
        {
            var ops     = OperationsFactory.CreateCommentOps();
            var comment = new Comment()
            {
                BlogPostID     = 1,
                CommentContent = "Lets test these thangs",
                Status         = new Status()
                {
                    StatusID = 1
                },
                User          = new User(),
                Nickname      = "Kiley",
                DateOfComment = new DateTime(7 / 24 / 2015)
            };

            ops.CreateComment(comment);
            var commentList = ops.GetAllCommentsByBlogPostID(1);

            Assert.AreEqual(1, commentList.Count);
        }