Exemple #1
0
        public IActionResult AddComment([FromBody] CommentRequestModel model)
        {
            var user = this.User.FindFirst(ClaimTypes.NameIdentifier).Value;

            PostDAL.AddComment(model, user);

            return(new OkResult());
        }
Exemple #2
0
        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);
            }
        }