public IHttpActionResult AddComment(int postId, int userId, CommentForCreationDTO model) { if (!ModelState.IsValid) { return(BadRequest()); } var result = _commentRepository.CommentExists(userId, postId); if (result == true) { return(BadRequest("birden fazla yorum ekleyemezsiniz")); } PostComment postComment = new PostComment(); postComment.UserId = userId; postComment.PostId = postId; postComment.Comment = model.Comment; postComment.DateCreated = DateTime.Now; try { _commentRepository.AddCommentByUser(postComment); } catch (Exception) { throw; } return(Ok()); }