public async Task <IActionResult> PutUserInfo([FromRoute] int id, [FromBody] UserInfo userInfo) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != userInfo.ID) { return(BadRequest()); } _context.Entry(userInfo).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserInfoExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutExercise([FromRoute] long id, [FromBody] Exercise exercise) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != exercise.ID) { return(BadRequest()); } _context.Entry(exercise).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ExerciseExists(id)) { return(NotFound()); } else { throw; } } return(Ok(exercise)); //return NoContent(); }