public async Task<IHttpActionResult> Post( RaceResult raceResult )
 {
     if ( ModelState.IsValid == false )
     {
         return BadRequest( ModelState );
     }
     await ResultsService.Create( raceResult );
     if ( raceResult.Id == 0 )
     {
         return BadRequest();
     }
     return Created( raceResult );
 }
        public async Task<RaceResult> Update( RaceResult updated )
        {
            if ( updated == null )
            {
                return null;
            }

            RaceResult existing = await Db.RaceResults.FindAsync( updated.Id );
            if ( existing == null )
            {
                return null;
            }

            Db.Entry( existing ).CurrentValues.SetValues( updated );
            await Db.SaveChangesAsync();
            return existing;
        }
        public async Task<IHttpActionResult> Put( [FromODataUri] int key, RaceResult raceResult )
        {
            if ( raceResult == null ||
                 ModelState.IsValid == false )
            {
                return BadRequest();
            }

            RaceResult original = await ResultsService.Find( key );

            if ( original == null )
            {
                return NotFound();
            }

            await ResultsService.Update( raceResult );

            return Updated( raceResult );
        }
 public async Task<int> Delete( RaceResult delete )
 {
     Db.RaceResults.Remove( delete );
     return await Db.SaveChangesAsync();
 }
 public async Task<RaceResult> Create( RaceResult newRaceResult )
 {
     Db.RaceResults.Add( newRaceResult );
     await Db.SaveChangesAsync();
     return newRaceResult;
 }