예제 #1
0
 // Update race
 public void UpdateRace(int ID)
 {
     Race race = new Race();
     if (TryUpdateModel(race, new FormValueProvider(ModelBindingExecutionContext)))
     {
         RaceManagment.UpdateRace(race);
     }
 }
예제 #2
0
 // Modify race
 public static void UpdateRace(Race race)
 {
     List<Race> races = GetAllRaces();
     races.RemoveAll(x => x.ID == race.ID);
     races.Add(race);
     File.Delete(_fileWithRaces);
     foreach (Race x in races)
     {
         AddRace(x);
     }
 }
예제 #3
0
 // Add race
 public static void AddRace(Race race)
 {
     string token = "";
     string[] strings = { race.ID.ToString(), race.Airport, race.Departure, race.Destination, race.DepartureDateTime.ToString(), race.DestinationDateTime.ToString(), race.DelayTimeSpan.ToString() };
     foreach (string x in strings)
     {
         token += x;
         token += _crazyToken;
     }
     File.AppendAllLines(_fileWithRaces, new string[] { token });
 }
예제 #4
0
 // New race
 public void InsertRace()
 {
     Race race = new Race();
     if (TryUpdateModel(race, new FormValueProvider(ModelBindingExecutionContext)))
     {
         int id = int.Parse(File.ReadAllText(_fileWithID));
         race.ID = id;
         id++;
         File.WriteAllText(_fileWithID, id.ToString());
         RaceManagment.AddRace(race);
     }
 }