public async Task <ActionResult <GenreDto> > Post([FromBody] GenreCreateDto genreCreateDto) { GenreDto newGenre = _mapper.Map <GenreDto>( await _genreService.AddAsync(_mapper.Map <Genre>(genreCreateDto)) ); return(CreatedAtAction("Get", new { id = newGenre.Id }, newGenre)); }
public async Task <IActionResult> Post([FromBody] BLGenre genre) { if (genre == null || genre.Name.Length == 0) { return(BadRequest("Wrong game model")); } await _genreService.AddAsync(genre); return(Created(this.RouteData.ToString(), genre)); }
public async Task <IActionResult> AddGenre(GenreViewModel genreViewModel) { if (genreViewModel is null) { throw new System.ArgumentNullException(nameof(genreViewModel)); } var genreDto = _mapper.Map <GenreDto>(genreViewModel); var result = await _genreService.AddAsync(genreDto); return(Ok(result)); }
public async Task <IActionResult> Post([FromBody] BLL.Models.Genre genre) { return(Ok(await service.AddAsync(genre))); }
protected override async Task <GetGenreDto> ExecuteAsync(CreateGenreCommand request, CancellationToken ct) { return(await _genreService.AddAsync(_mapper.Map <AddGenreDto>(request), ct)); }