public async Task<IHttpActionResult> PutTopTimesTodayEntry(int id, TopTimesTodayEntry topTimesTodayEntry) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != topTimesTodayEntry.Id) { return BadRequest(); } db.Entry(topTimesTodayEntry).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TopTimesTodayEntryExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public async Task<IHttpActionResult> PostTopTimesTodayEntry(TopTimesTodayEntry topTimesTodayEntry) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.topTimesToday.Add(topTimesTodayEntry); await db.SaveChangesAsync(); return CreatedAtRoute("DefaultApi", new { id = topTimesTodayEntry.Id }, topTimesTodayEntry); }