public async Task <IActionResult> PutCharacters([FromRoute] int id, [FromBody] Characters characters) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != characters.CharacterId) { return(BadRequest()); } _context.Entry(characters).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CharactersExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutUsers([FromRoute] int id, [FromBody] Users users) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != users.UserId) { return(BadRequest()); } _context.Entry(users).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException db) { if (!UsersExists(id)) { return(NotFound()); } else { var exception = db.Message; throw; } } return(NoContent()); }