Exemple #1
0
 public void Create_Shots()
 {
     foreach (ScorecardHoleViewModel hole in scorecardHoles)
     {
         foreach (PlayerRoundViewModel playerRound in playerRoundViewModels)
         {
             DatabaseContext.Shot newShot = new DatabaseContext.Shot();
             newShot._linkedPlayerRoundID   = playerRound.playerRound.PlayerRoundID;
             newShot._linkedScorecardHoleID = scorecard.ScorecardID;
             newShot.HoleNumber             = hole.HoleNumber;
             newShot.Par = hole.Par;
             newShot.parentScorecardHole = hole.scorecardHole;
             newShot.PlayerRound         = playerRound.playerRound;
             db.Shots.InsertOnSubmit(newShot);
             playerRound.playerRound.Shots.Add(newShot);
             db.SubmitChanges();
             ShotViewModel newShotViewModel = new ShotViewModel(newShot);
             playerRound.shots.Add(newShotViewModel);
             hole.shots.Add(newShotViewModel);
         }
     }
 }
 public ShotViewModel(DatabaseContext.Shot shot)
 {
     this.shot = shot;
     this.db   = App.DB;
 }