public async Task<IHttpActionResult> PutTimerRestPeriod(int id, TimerRestPeriod timerRestPeriod) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != timerRestPeriod.TimerRestPeriodID) { return BadRequest(); } db.Entry(timerRestPeriod).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TimerRestPeriodExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public async Task<IHttpActionResult> PostTimerRestPeriod(TimerRestPeriod timerRestPeriod) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.TimerRestPeriods.Add(timerRestPeriod); await db.SaveChangesAsync(); return CreatedAtRoute("DefaultApi", new { id = timerRestPeriod.TimerRestPeriodID }, timerRestPeriod); }