public void UpdateMovies_Returns_NoContentResult()
        {
            // Arrange
            var movieRepositoryMock = new Mock <IMovieRepository>();
            var subGenreIMapperMock = new MapperConfiguration(config =>
            {
                config.AddProfile(new MovieMapper());
            });
            var movieMapper = subGenreIMapperMock.CreateMapper();
            MoviesController movieApiController = new MoviesController(movieRepositoryMock.Object, mapper: movieMapper);
            var movieModel = new MovieModel()
            {
                Name        = "Adult Content",
                DateCreated = DateTime.Parse("15 May 2015"),
                Id          = Guid.NewGuid(),
                GenreId     = Guid.NewGuid(),
                Genres      = new GenreModel(),
            };
            var movieDto = new MoviesUpdateDTO()
            {
                Id          = movieModel.Id,
                Name        = movieModel.Name,
                DateCreated = movieModel.DateCreated,
                GenreId     = movieModel.GenreId,
                SubGenreId  = Guid.NewGuid()
            };

            movieRepositoryMock.Setup(repo => repo.UpdateMovie(It.IsAny <MovieModel>())).Returns(true);
            // Act
            var subGenreResult  = movieApiController.UpdateMovie(movieModel.Id, movieDto);
            var noContentResult = subGenreResult as NoContentResult;

            // Assert
            Assert.True(noContentResult.StatusCode is StatusCodes.Status204NoContent);
        }
        public IActionResult UpdateMovie(Guid moviesId, [FromBody] MoviesUpdateDTO moviesDto)
        {
            if (moviesDto == null || moviesId != moviesDto.Id)
            {
                return(BadRequest(ModelState));
            }

            var genreObj = _mapper.Map <MovieModel>(moviesDto);

            if (!_movieRepo.UpdateMovie(genreObj))
            {
                ModelState.AddModelError("", $"Something went wrong when updating the record {genreObj.Name}");
                return(StatusCode(500, ModelState));
            }

            return(NoContent());
        }