public async Task <IActionResult> PutTimeLog([FromRoute] int id, [FromBody] TimeLog timeLog) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != timeLog.TimeLogId) { return(BadRequest()); } _context.Entry(timeLog).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TimeLogExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutUserData([FromRoute] int id, [FromBody] UserData userData) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != userData.UserDataId) { return(BadRequest()); } _context.Entry(userData).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserDataExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }