public Team GetById(int?teamId) { if (teamId != null) { return(repo.GetById((int)teamId)); } else { return(null); } }
public bool CompletePitStop(int raceEventId, int pitStopId, int teamId, int currentPitStopOrder) { var data = repo.Create(); data.RaceEventId = raceEventId; data.PitStopId = pitStopId; data.TeamId = teamId; data.CompletedOn = DateTime.Now; data.NoOfCompletedStop = currentPitStopOrder; var team = teamRepo.GetById(teamId); var pitStops = raceEventPitStopRepo.GetPitStopByRaceId(raceEventId).ToList(); if (currentPitStopOrder == pitStops.Count) { team.DistanceToNextStop = 0; } repo.Add(data); return(repo.SaveChanges()); }