public async Task <IActionResult> PutSession([FromRoute] string id, [FromBody] Session session) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != session.Id) { return(BadRequest()); } _context.Entry(session).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SessionExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutPlayer([FromRoute] int id, [FromBody] Player player) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != player.Id) { return(BadRequest()); } _context.Entry(player).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PlayerExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutCharacter([FromRoute] string sessionId, int playerId, [FromBody] Character character) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (sessionId != character.SessionId && playerId != character.PlayerId) { return(BadRequest()); } _context.Entry(character).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CharacterExists(character.Id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public ActionResult Edit([Bind(Include = "ID,Name,Strength,Initiative,RaceSelection,SubRaceSelection,ClassSelection,Dexterity, Constitution, Intelligence, Wisdom, Charisma")] Characters character) { if (ModelState.IsValid) { db.Entry(character).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("List")); } return(View(character)); }