public async Task <ActionResult <TypePokemon> > PostTypePokemon(TypePokemon typePokemon) { _context.TypePokemon.Add(typePokemon); await _context.SaveChangesAsync(); return(CreatedAtAction("GetTypePokemon", new { id = typePokemon.TypePokemonId }, typePokemon)); }
public async Task <IActionResult> PutTypePokemon(int id, TypePokemon typePokemon) { if (id != typePokemon.TypePokemonId) { return(BadRequest()); } _context.Entry(typePokemon).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TypePokemonExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }