Beispiel #1
0
        public async Task <IActionResult> InsertMovie([FromBody] MovieRequestDto movieRequestDto)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            Movie savedMovie = await moviesRepository.InsertMovie(movieRequestDto.ToMovie());

            return(Ok(savedMovie.ToResponseMovie()));
        }
Beispiel #2
0
        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());
        }
Beispiel #3
0
 public MovieRequestBuilder(MovieRequestDto requestDto)
 {
     movieRequest = requestDto;
 }