public IActionResult AddComment([FromBody] CommentRequestModel model) { var user = this.User.FindFirst(ClaimTypes.NameIdentifier).Value; PostDAL.AddComment(model, user); return(new OkResult()); }
public bool AddComment(string text, ObjectId postId) { Comment comment = new Comment(); comment.Text = text; comment.OwnerId = userDAL.GetUserId(userBLL.LoginRead()); comment.DateTime = DateTime.Now.ToString(); try { postDAL.AddComment(comment, postId); return(true); } catch { return(false); } }