public IHttpActionResult GetRaceScores(int id)
        {
            try
            {
                db.GetRacesScores();

                RacesScores rs = new RacesScores();
                rs.Race = db.races[id].Circuit;
                if (db.RacesScores.ContainsValue(rs) == true)
                {
                    return(NotFound());
                }

                racesSelected = new List <RacesScores>();
                foreach (var item in db.RacesScores)
                {
                    if (item.Value.Race == db.races[id].Circuit)
                    {
                        racesSelected.Add(item.Value);
                    }
                }
                return(Ok(racesSelected));
            }
            catch (Exception)
            {
                return(NotFound());
            }
        }
Example #2
0
 public IEnumerable <RacesScore> GetAllRacesScores()
 {
     db.GetRacesScores();
     return(db.RacesScores.Values);
 }