Save() public method

Saves this instance.
public Save ( ) : bool
return bool
Beispiel #1
0
        public void It_Should_Be_Possible_To_Connect_An_Athlete_To_A_Startnumber()
        {
            Given("we have an athlete and a startnumber registrert", () =>
            {
                athlete.ConnectToRace(race.RaceId);
                timer = CreateNewTimerModelWithCheckpoints(race);
                checkpointOrder = new CheckpointOrderModel();
                checkpointOrder.AddCheckpointOrderDB(timer.CurrentCheckpointId, 1);
                timer.Start();
                timer.AddRuntime(400, timer.GetFirstCheckpointId());
                intermediate = new RaceIntermediateModel(timer.CurrentCheckpointId, checkpointOrder.ID, timer.CheckpointRuntimes[timer.CurrentCheckpointId].First().Key);
                intermediate.Save();
            });

            When("we want to connect athletes to startnumbers", () =>
            {
                RaceIntermediateModel.MergeAthletes(race.RaceId);
            });

            Then("athletes should be connected to raceintermediate", () =>
            {
                RaceIntermediateModel.GetRaceintermediatesForRace(race.RaceId).First().AthleteId.ShouldNotBeNull();

            });
        }
Beispiel #2
0
 /// <summary>
 /// Adds the startnumber.
 /// </summary>
 /// <param name="cpId">The cp id.</param>
 /// <param name="startNr">The start nr.</param>
 /// <param name="runtimeint">The runtimeint.</param>
 /// <returns></returns>
 public void AddStartnumber(int cpId, int startNr, int runtimeint)
 {
     var checkpointOrderId = CheckpointOrder.AddCheckpointOrderDB(cpId, startNr);
     if (checkpointOrderId == 0) return;
     var runtimeId = Timer.AddRuntime(runtimeint, cpId).Id;
     RaceIntermediateModel raceIntermediate = new RaceIntermediateModel(cpId, checkpointOrderId, runtimeId);
     raceIntermediate.Save();
     CheckpointIntermediates[CurrentCheckpointId].Add(raceIntermediate);
 }
Beispiel #3
0
        public static RaceIntermediateModel Merge(int checkpointId, int checkpointOrderId, int runtimeId)
        {
            var raceIntermediateModel = new RaceIntermediateModel(checkpointId, checkpointOrderId, runtimeId);
            if (raceIntermediateModel.Save())
            {
                var cpo = CheckpointOrderModel.GetById(checkpointOrderId);
                cpo.IsMerged = true;
                cpo.Update();

                var runtime = RuntimeModel.getById(runtimeId);
                runtime.IsMerged = true;
                runtime.Update();

                return raceIntermediateModel;
            }
            return null;
        }