Esempio n. 1
0
        public async Task <ActionResult> Post(MovieTheaterCreationDto movieCreationDto)
        {
            var movieTheater = mapper.Map <MovieTheater>(movieCreationDto);

            context.Add(movieTheater);
            await context.SaveChangesAsync();

            return(NoContent());
        }
Esempio n. 2
0
        public async Task <ActionResult> Put(int id, MovieTheaterCreationDto movieCreationDto)
        {
            var movieTheater = await context.MovieTheaters.FirstOrDefaultAsync(x => x.Id == id);

            if (movieTheater == null)
            {
                return(NotFound());
            }

            mapper.Map(movieCreationDto, movieTheater);
            await context.SaveChangesAsync();

            return(NoContent());
        }