public async Task <ActionResult <Hero> > PostHero(Hero hero)
        {
            _context.Heroes.Add(hero);
            await _context.SaveChangesAsync();

            return(CreatedAtAction(nameof(GetHero), new { id = hero.id }, hero));
        }
Exemple #2
0
        public async Task <IActionResult> UpdateHero(Hero hero)
        {
            _context.Entry(hero).State = EntityState.Modified;
            await _context.SaveChangesAsync();

            return(NoContent());
        }