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); }
public async Task <IActionResult> Add(GenreDtoAdd newItem) { var result = await _genreService.AddGenre(newItem); return(Ok(result)); }