public IPlayer Activate(string id) { DbRepository.Transacted(() => { var newPlayer = new DbPlayer() { ExternalId = id, ExternalType = "FB" }; newPlayer.Id = (int)DbRepository.Current.Add(newPlayer); var standing = new DbStanding(); standing.Player = newPlayer; standing.Season = DbRepository.Current.Single<DbSeason>(s => s.DateCreated == DbRepository.Current.All<DbSeason>().Max(max => max.DateCreated).Date); standing.UnlockedRules = Rules.Open; DbRepository.Current.Add(standing); CreateInitialDeck(newPlayer); }); return new Player(id); }
public PlayerStanding(DbStanding standing) { DbEntity = standing; }