public async static void AssignBETAItems(Player player) { ////Give them a new phone Phone phone = new Phone() { BatteryLevel = 100, IMEI = await PhoneManager.GenerateImeiAsync(), PoweredOn = true, WallpaperId = 2 }; await PhoneRepository.AddNew(phone); PhoneApp phoneApp = new PhoneApp() { AppId = 0, Installed = true, PhoneId = phone.Id, Purchased = true, Position = "51" }; await PhoneAppRepository.AddNew(phoneApp); PhoneApp messagesApp = new PhoneApp() { AppId = 1, Installed = true, PhoneId = phone.Id, Purchased = true, Position = "52" }; await PhoneAppRepository.AddNew(messagesApp); PhoneApp settingsApp = new PhoneApp() { AppId = 2, Installed = true, PhoneId = phone.Id, Purchased = true, Position = "44" }; await PhoneAppRepository.AddNew(settingsApp); SimCard sim = new SimCard() { Number = await PhoneManager.GeneratePhoneNumberAsync(), Credit = 2000, IsBlocked = false }; await SimCardRepository.AddNew(sim); phone.InstalledSim = sim.Id; PhoneRepository.UpdateAsync(phone); }
public async static Task AddNew(PhoneApp app) { using (var db = new Database()) { db.PhoneApp.Add(app); await db.SaveChangesAsync(); } }
public static async void UpdateAsync(PhoneApp item) { using (var db = new Database()) { db.PhoneApp.Attach(item); db.Entry(item).State = System.Data.Entity.EntityState.Modified; await db.SaveChangesAsync(); } }
// Use this for initialization void Start() { tweetReader = GetComponentInParent <TweetReader>(); phone = transform.parent.GetComponent <PhoneApp>(); }