Пример #1
0
        public async Task <ActionResult> Post([FromBody] TheaterAddDTO theaterAddDTO)
        {
            var theather = mapper.Map <Theaters>(theaterAddDTO);

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

            return(NoContent());
        }
Пример #2
0
        public async Task <ActionResult> Put(int Id, [FromBody] TheaterAddDTO theaterAdd)
        {
            var theater = await context.Theaters.FirstOrDefaultAsync(x => x.id == Id);

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

            theater = mapper.Map(theaterAdd, theater);

            await context.SaveChangesAsync();

            return(NoContent());
        }