Example #1
0
        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;
        }
Example #2
0
 public static void Save(Realm realm)
 {
     DbContext.Current.Add(realm);
 }
Example #3
0
 public static Realm GetByRegion(Realm.RegionType region)
 {
     return DbContext.Current.Single<Realm>(r => r.Region == region);
 }