public async Task <IActionResult> PutUser([FromRoute] string id, [FromBody] User user) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != user.Id) { return(BadRequest()); } _context.Entry(user).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutGuides([FromRoute] int id, [FromBody] Guides guides) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != guides.GuideId) { return(BadRequest()); } _context.Entry(guides).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!GuidesExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }