コード例 #1
0
        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));
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        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));
        }
コード例 #4
0
 public async Task <IActionResult> Post([FromBody] BLL.Models.Genre genre)
 {
     return(Ok(await service.AddAsync(genre)));
 }
コード例 #5
0
 protected override async Task <GetGenreDto> ExecuteAsync(CreateGenreCommand request, CancellationToken ct)
 {
     return(await _genreService.AddAsync(_mapper.Map <AddGenreDto>(request), ct));
 }