public async Task<IHttpActionResult> PutTimerWarning(int id, TimerWarning timerWarning) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != timerWarning.TimerWarningID) { return BadRequest(); } db.Entry(timerWarning).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TimerWarningExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
private void TimerWarning_Tick(object sender, EventArgs e) { TimerWarning.Enabled = false; TimerWarning.Stop(); DisplayWarning(); SetTimerWarningInterval(); TimerWarning.Enabled = true; TimerWarning.Start(); }
public async Task<IHttpActionResult> PostTimerWarning(TimerWarning timerWarning) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.TimerWarnings.Add(timerWarning); await db.SaveChangesAsync(); return CreatedAtRoute("DefaultApi", new { id = timerWarning.TimerWarningID }, timerWarning); }