private void SetDetailView(PlayerDetails player) { if (player != null) { PlayerDetails = player.Clone(); PlayerDetails.IsDirty = false; } }
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(); }