public IActionResult Post([FromBody] Comment comment) { if (!ModelState.IsValid) { return(BadRequest(ModelState.ToErrorObject())); } return(Ok(comments.Create(comment))); }
public int Create(Comment comment) { if (comment.Message == null) { throw new Exception("Message is null"); } return(_comment.Create(comment)); }
public IActionResult AddComment([Bind("ProjectInfoId", "TaskId", "Commentdetails", "DateTime", "ApplicationUsersId")] Comment comment) { if (ModelState.IsValid) { _commentRepo.Create(comment); return(RedirectToAction("ViewAllCommentByTaskId", new{ id = comment.TaskId })); } return(View(comment)); }
public OperationResult AddComment(AddComment command) { OperationResult operationResult = new OperationResult(); var comment = new Comment(command.Name, command.Email, command.Message, command.ProductId); _commentRepo.Create(comment); _commentRepo.Save(); return(operationResult.Succeeded()); }
public int Create(CreateCommentViewModel model) { return(_comment.Create(_mapper.Map <Comment>(model))); }