예제 #1
0
 private void SetDetailView(PlayerDetails player)
 {
     if (player != null)
     {
         PlayerDetails         = player.Clone();
         PlayerDetails.IsDirty = false;
     }
 }
예제 #2
0
        private void SaveCommandHandler()
        {
            PlayerDetails.IsDirty = false;

            if (PlayerDetails.Id == Guid.Empty)
            {
                PlayerDetails.Id = Guid.NewGuid();
                Players.Add(PlayerDetails);
            }
            else
            {
                var playerToChange = Players.FirstOrDefault(m => m.Id == PlayerDetails.Id);

                playerToChange?.CopyFrom(PlayerDetails);
            }

            // Disconnect object before saving to prevent same object being linked to master detail view.
            _playersRepository.Add(PlayerDetails.Clone());

            _playersRepository.SaveAll();
        }