Beispiel #1
0
        public async Task <GetHeroDTO> CreateHero(InsertHeroDTO hero)
        {
            var created = _heroRepository.Create(_mapper.Map <Hero>(hero));
            await _heroRepository.SaveChangesAsync();

            return(_mapper.Map <GetHeroDTO>(created));
        }
        public async Task <ActionResult <GetHeroDTO> > Create([FromBody] InsertHeroDTO dto)
        {
            var newHero = await _heroAppService.CreateHero(dto);

            return(CreatedAtAction("GetHeroById", new { id = newHero.Id }, newHero));
        }
 public async Task <ActionResult <GetHeroDTO> > Create([FromBody] InsertHeroDTO dto)
 {
     return(Ok(await _heroAppService.CreateHero(dto)));
 }