public ActionResult AddComment(AddCommentViewModel model) { if (ModelState.IsValid) { _postRepository.AddComment(model); } return(RedirectToAction("SinglePost", "Post", new { id = model.PostId })); }
public HttpStatusCode Create(Comment comment) { if (ModelState.IsValid) { _repository.AddComment(comment); return(HttpStatusCode.Created); } return(HttpStatusCode.BadRequest); }
public ActionResult PostComment([Bind(Exclude = "Id")] CommentVM comment) { if (ModelState.IsValid) { var newcommentdata = Mapper.Map <CommentVM, Comment>(comment); newcommentdata.CommentedDate = DateTime.Now; _blogRepository.AddComment(newcommentdata); return(RedirectToAction("Detail", new { blogId = comment.BlogId })); } return(View()); }
public ActionResult CreateComment(long id, Comment comment) { if (!ModelState.IsValid) { return(BadRequest(comment)); } Post post = blogRepository.GetById(id); if (post != null) { blogRepository.AddComment(post, comment); return(Ok()); } return(NotFound(id)); }
public async Task AddComment(AddCommentRequest request) { var comment = _mapper.Map <AddCommentRequest, Comment>(request); await _repository.AddComment(comment); }
public async Task <long> AddComment(string blogId, CommentEntity comment) { var model = _mapper.Map <CommentModel>(comment); return(await _blogRepository.AddComment(blogId, model)); }
public JsonCamelCaseResult Add(Comment comment) { _blogRepository.AddComment(comment); return(new JsonCamelCaseResult("Add success")); }
public IActionResult AddComment(Comment comment, Guid postId) { repository.AddComment(comment, postId); return(RedirectToAction(nameof(Post), new { id = repository.Get(postId).Id })); }