public async Task<IHttpActionResult> PutTopScoresTodayEntry(int id, TopScoresTodayEntry topScoresTodayEntry) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != topScoresTodayEntry.Id) { return BadRequest(); } db.Entry(topScoresTodayEntry).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TopScoresTodayEntryExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public async Task<IHttpActionResult> PostTopScoresTodayEntry(TopScoresTodayEntry topScoresTodayEntry) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.topScoresToday.Add(topScoresTodayEntry); await db.SaveChangesAsync(); return CreatedAtRoute("DefaultApi", new { id = topScoresTodayEntry.Id }, topScoresTodayEntry); }