static void Main(string[] args) { string certificatesFolder = System.Configuration.ConfigurationManager.AppSettings["certificate_path"]; string certificatesPassword = System.Configuration.ConfigurationManager.AppSettings["certificate_password"]; InitFactories(); using (var db = new NotificationsModel()) { char input; do { Product p0 = db.Products.Find(1); p0.Price = 0.49; db.SaveChanges(); PushService service = PushService.Instance; service.Init(certificatesFolder, certificatesPassword, "", "", db.Notifications); service.Push(); // Restore the normal state p0.Price = 0.99; db.SaveChanges(); input = Console.ReadKey().KeyChar; } while (input == 'c'); } }
private static void Unregister(string udid) { using (var db = new NotificationsModel()) { Device device = Find(db, udid); if (device != null) { db.Devices.Remove(device); db.SaveChanges(); } } }
public static void Register(string udid, int type, bool isTablet, User owner) { using (var db = new NotificationsModel()) { Device device = Find(db, udid); if (device != null) { device.IsTablet = isTablet; device.Type = type; device.Owner = owner; } else { device = new Device() { IdentifierForVendor = udid, Type = type, IsTablet = isTablet, Owner = owner }; db.Devices.Add(device); } db.SaveChanges(); } }