public async Task <IActionResult> PutCalamityCharacter(int id, CalamityCharacter calamityCharacter) { if (id != calamityCharacter.CalamityId) { return(BadRequest()); } _context.Entry(calamityCharacter).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CalamityCharacterExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <CalamityCharacter> > PostCalamityCharacter(CalamityCharacter calamityCharacter) { _context.CalamityCharacter.Add(calamityCharacter); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (CalamityCharacterExists(calamityCharacter.CalamityId)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetCalamityCharacter", new { id = calamityCharacter.CalamityId }, calamityCharacter)); }