public IHttpActionResult GetRacesScore(int id) { try { List <RacesScore> rS = db.GetRacesScores().Values.ToList().FindAll(r => r.Race.Id == id); rS = rS.OrderBy(r => r.Pos.Pos).ToList(); for (int i = 0; i < rS.Count; i++) { if (rS[i].Pos.Pos == 0) { RacesScore r = rS[i]; rS.RemoveAt(i--); rS.Add(r); } else { break; } } return(Ok(rS)); } catch (Exception) { return(NotFound()); } }
public RacesScoreByRace(RacesScore rs) { this.id = rs.ID; this.driverLastName = rs.Driver.Lastname; this.driverFirstName = rs.Driver.Firstname; this.pos = rs.Pos.Pos; this.score = rs.Pos.Score; this.details = rs.Pos.Details; this.teamName = rs.Team.Name; }