public IHttpActionResult PutRaceResultSet(int id, RaceResultSet raceResultSet) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != raceResultSet.Id) { return(BadRequest()); } db.Entry(raceResultSet).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!RaceResultSetExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutRace(int id, Race race) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != race.Id) { return(BadRequest()); } db.Entry(race).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbEntityValidationException ex) { foreach (var entityValidationErrors in ex.EntityValidationErrors) { foreach (var validationError in entityValidationErrors.ValidationErrors) { Console.Write("Property: " + validationError.PropertyName + " Error: " + validationError.ErrorMessage); } } } catch (DbUpdateConcurrencyException) { if (!RaceExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }