Esempio n. 1
0
        public async Task <int> PostMovie(CreateMovieServiceModel movieServiceModel)
        {
            var movie = new Data.Models.Movie
            {
                DirectorName = movieServiceModel.DirectorName,
                Genre        = movieServiceModel.Genre,
                Name         = movieServiceModel.Name,
                ReleaseYear  = movieServiceModel.ReleaseYear
            };

            _dbContext.Add(movie);
            await _dbContext.SaveChangesAsync();

            return(movie.Id);
        }
        public async Task <ActionResult> PostMovie(CreateMovieServiceModel movieServiceModel)
        {
            var id = await _movieService.PostMovie(movieServiceModel);

            return(CreatedAtAction("PostMovie", id));
        }