public async Task <IHttpActionResult> PutGetFixtures(int id, GetFixtures getFixtures) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != getFixtures.Id) { return(BadRequest()); } db.Entry(getFixtures).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!GetFixturesExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> PostFixture(Fixture fixture) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } // repo.InsertItem(fixture); // repo.Save(); db.Fixtures.Add(fixture); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = fixture.Id }, fixture)); }