예제 #1
0
        public async Task <ServiceResponse <GenreDto> > AddGenre(GenreDtoAdd newItem)
        {
            var   response = new ServiceResponse <GenreDto>();
            Genre genre    = _mapper.Map <Genre>(newItem);

            _context.Genres.Add(genre);

            await _context.SaveChangesAsync();

            GenreDto genreDTO = _mapper.Map <GenreDto>(genre);

            response.Data = genreDTO;

            return(response);
        }
예제 #2
0
        public async Task <IActionResult> Add(GenreDtoAdd newItem)
        {
            var result = await _genreService.AddGenre(newItem);

            return(Ok(result));
        }