public async Task<ActionResult> Create([Bind(Include = "PostID,ParentCommentID,Content")] CommentView commentView)
        {
            string userId = User.Identity.GetUserId();
            if (ModelState.IsValid && await GetDb().Posts.AnyAsync(p =>
                    p.PostID == commentView.PostID && (p.CreatedOn != null || p.AuthorID == userId))
               &&
               (commentView.ParentCommentID == null || await GetDb().Comments.AnyAsync(c =>
                    c.CommentID == commentView.ParentCommentID)))
            {
                Comment comment = new Comment();
                if (!await GetDb().Posts.AnyAsync(p => p.PostID == commentView.PostID))
                    return new EmptyResult();
                comment.PostID = commentView.PostID;
                if (await GetDb().Comments.AnyAsync(c => c.CommentID == commentView.ParentCommentID))
                    comment.ParentCommentID = commentView.ParentCommentID;
                comment.AuthorID = User.Identity.GetUserId();
                comment.CreatedOn = new DateTimeOffset(DateTime.Now);
                comment = GetDb().Comments.Add(comment);
                await GetDb().SaveChangesAsync();

                CommentContent commentContent = new CommentContent();
                commentContent.CommentID = comment.CommentID;
                commentContent.Content = commentView.Content;
                GetDb().CommentContents.Add(commentContent);
                await GetDb().SaveChangesAsync();
                return PartialView("Comments/_CommentPartial", comment);
            }
            return new EmptyResult();
        }
 public EditedCommentView(Comment comment) : this()
 {
     this.PostID = comment.PostID;
     this.ParentCommentID = comment.ParentCommentID;
     this.Content = comment.Content.Content;
     this.UpdateReason = comment.Content.UpdateReason;
     this.IsDeleted = comment.Content.IsDeleted;
 }