public async Task <IActionResult> PutReportingPeriod([FromRoute] int id, [FromBody] ReportingPeriod reportingPeriod) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != reportingPeriod.Id) { return(BadRequest()); } _context.Entry(reportingPeriod).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ReportingPeriodExists(id)) { return(NotFound()); } else { throw; } } return(Ok(reportingPeriod)); }
public async Task <IActionResult> PutUser([FromRoute] int 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(Ok(user)); }