public async Task <CommentPutDTO> PostComment(CommentPutDTO commentPostDTO) { if (commentPostDTO == null) { throw new ArgumentNullException(nameof(commentPostDTO)); } var commentResult = _context.Comments.Add(new Comment() { CommentText = commentPostDTO.CommentText, Date = commentPostDTO.Date, MovieId = commentPostDTO.MovieId, UserId = commentPostDTO.UserId }); await _context.SaveChangesAsync().ConfigureAwait(false); commentPostDTO.Id = commentResult.Entity.Id; return(commentPostDTO); }
public Task <CommentPutDTO> PutComment(int id, CommentPutDTO commentPutDTO) { throw new NotImplementedException(); }
public async Task <ActionResult <Comment> > PostComment(CommentPutDTO commentPutDTO) { var commentResult = await _commentRepository.PostComment(commentPutDTO).ConfigureAwait(false); return(CreatedAtAction("GetComment", new { id = commentResult.Id }, commentResult)); }