Beispiel #1
0
 public ActionResult Create(int raceId, string txtCheckpointName)
 {
     if (String.IsNullOrEmpty(txtCheckpointName))
     {
         SetTempData(KEY_NAME_EMPTY, true);
     }
     else
     {
         CheckpointModel model = new CheckpointModel(txtCheckpointName, raceId); // race with raceId exists in the database already.
         model.SaveToDb();
         SetTempData(KEY_A_CHECKPOINT_WAS_CREATED_SUCCESSFULLY, true);
     }
     return RedirectToAction("Create"); // Redirect in order to reset form values.
 }
Beispiel #2
0
 /// <summary>
 /// Creates the new timer model with checkpoints.
 /// </summary>
 /// <returns></returns>
 private void Setup()
 {
     eventModel = new EventModel("Testevent", DateTime.Today);
     eventModel.Save();
     race = new RaceModel("Testrace", DateTime.Today);
     race.EventId = eventModel.EventId;
     race.Save();
     timer = new TimerModel();
     timer.RaceID = race.RaceId;
     checkpoint = new CheckpointModel("Checkpoint1", timer, race, 1);
     checkpoint.SaveToDb();
     checkpointorder = new CheckpointOrderModel();
     checkpointorder.AddCheckpointOrderDB(checkpoint.Id, 12);
     checkpointorder.StartingNumber = 12;
     timer.CurrentCheckpointId = timer.GetFirstCheckpointId();
     timer.CheckpointRuntimes.Add(timer.CurrentCheckpointId, new Dictionary<int, int>());
     timer.SaveToDb();
     timestart = new TimeStartnumberModel(timer);
     timestart.CheckpointOrder = checkpointorder;
     //timestart.AddStartnumber(checkpoint.Id, checkpointorder.StartingNumber, 500);
 }