Exemple #1
0
        public async Task <IActionResult> Post(int id)
        {
            Publication post = _publication.GetPostDB(id);

            if (post == null)
            {
                return(NotFound());
            }
            return(View(post));
        }
        public IActionResult CreateComment(CreateCommentViewModel model)
        {
            Comment comment = new Comment
            {
                CommentText   = model.CommentText,
                LoginUser     = _user.GetUserDB(_userManager.GetUserId(User)).UserName,
                PublicationID = ID,
                Publication   = _publication.GetPostDB(ID)
            };

            _comment.AddCommentDB(comment);
            return(RedirectToAction("Post", "Publication", new { ID }));
        }
 public Publication GetPostDB(int id)
 {
     return(_publication.GetPostDB(id));
 }