public string CreateRace(string name, int laps) { var currentRace = RaceFactory.CreateRace(name, laps); this.raceRepository.Add(currentRace); return(string.Format(OutputMessages.RaceCreated, name)); }
public string CreateRace(string name, int laps) { var race = raceFactory.CreateRace("Race", name, laps); var raceInRepo = raceRepo.GetByName(name); if (raceInRepo != null) { throw new InvalidOperationException(String .Format(ExceptionMessages.RaceExists, name)); } raceRepo.Add(race); return(string.Format(OutputMessages.RaceCreated, name)); }