public async Task <IActionResult> PutCharacterRemarkableTrait(int id, CharacterRemarkableTrait characterRemarkableTrait) { if (id != characterRemarkableTrait.Id) { return(BadRequest()); } _context.Entry(characterRemarkableTrait).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CharacterRemarkableTraitExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <CharacterRemarkableTrait> > PostCharacterRemarkableTrait(CharacterRemarkableTrait characterRemarkableTrait) { _context.CharacterRemarkableTrait.Add(characterRemarkableTrait); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (CharacterRemarkableTraitExists(characterRemarkableTrait.Id)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetCharacterRemarkableTrait", new { id = characterRemarkableTrait.Id }, characterRemarkableTrait)); }