public static Realm CreateRandom() { Realm.RegionType region = (Realm.RegionType)HelperManager.RandomGenerator.Next(1, 5); // Load the realm. Realm realm = GetByRegion(region); if (realm == null) { // Create the realm if it doesn't exist. realm = new Realm(region); Save(realm); } return(realm); }
public static Realm GetByRegion(Realm.RegionType region) { return(DbContext.Current.Single <Realm>(r => r.Region == region)); }