Пример #1
0
        public IActionResult Details(int id)
        {
            BlogCommentsModel bcm = new BlogCommentsModel();

            bcm.Blog     = repositoryblog.GetById(id);
            bcm.Comments = repositoryblog.GetComments(bcm.Blog).Where(x => x.isApproved).ToList();
            bcm.Comment  = new Comment(bcm.Blog.BlogId);


            return(View(bcm));
        }
Пример #2
0
        public IActionResult Details(Comment comment)
        {
            if (ModelState.IsValid)
            {
                repositorycomment.AddComment(comment);
                return(RedirectToAction("Details", comment.BlogId));
            }
            else
            {
                BlogCommentsModel bcm = new BlogCommentsModel();

                bcm.Blog     = repositoryblog.GetById(comment.BlogId);
                bcm.Comments = repositoryblog.GetComments(bcm.Blog).Where(x => x.isApproved).ToList();
                bcm.Comment  = new Comment(bcm.Blog.BlogId);
                return(View(bcm));
            }
        }