public async Task <IActionResult> InsertMovie([FromBody] MovieRequestDto movieRequestDto) { if (!ModelState.IsValid) { return(BadRequest()); } Movie savedMovie = await moviesRepository.InsertMovie(movieRequestDto.ToMovie()); return(Ok(savedMovie.ToResponseMovie())); }
public async Task <IActionResult> UpdateMovie([FromRoute] string movieId, [FromBody] MovieRequestDto movieRequestDto) { if (!ModelState.IsValid) { return(BadRequest()); } var objectId = new ObjectId(); if (movieId.isValidObjectId(out objectId)) { var updateResult = await moviesRepository.UpdateMovie(movieRequestDto.ToMovie(objectId.ToString())); return(Ok(updateResult)); } return(BadRequest()); }
public MovieRequestBuilder(MovieRequestDto requestDto) { movieRequest = requestDto; }