Example #1
0
 public Client FindClient(int id)
 {
     using (var db = new DataContext())
     {
         return db.Client.Find(id);
     }
 }
Example #2
0
 public int GetPolicyCount()
 {
     using (var db = new DataContext())
     {
         return db.Policy.Count();
     }
 }
Example #3
0
 public bool SaveClient(Client client)
 {
     using (var db = new DataContext())
     {
         db.Client.Add(client);
         return db.SaveChanges() > 0;
     }
 }
Example #4
0
 public Policy[] FindClientPolicies(int clientId)
 {
     using (var db = new DataContext())
     {
         var client = db.Client.Include("Policy").FirstOrDefault(c => c.id == clientId);
         return client != null ? client.Policy.ToArray() : new Policy[0];
     }
 }
Example #5
0
 public bool SavePolicy(Policy policy)
 {
     using (var db = new DataContext())
     {
         db.InsuredObject.Add(policy.InsuredObject);
         db.Policy.Add(policy);
         return db.SaveChanges() > 0;
     }
 }
        public static void RegisterMembership()
        {
            Database.SetInitializer<DataContext>(null);

            try
            {
                using (var context = new DataContext())
                {
                    if (!context.Database.Exists())
                    {
                        ((IObjectContextAdapter)context).ObjectContext.CreateDatabase();
                    }
                }

                WebSecurity.InitializeDatabaseConnection("DefaultConnection", "mw_Users", "Id", "Email", true);
            }
            catch (Exception e)
            {
                throw new InvalidOperationException("The ASP.NET Simple Membership database could not be initialized. For more information, please see http://go.microsoft.com/fwlink/?LinkId=256588", e);
            }
        }
 public AppUserSecretStore(DataContext db)
 {
     dataContext = db;
     store = new UserSecretStore<UserSecret>(db);
 }
 public AppIdentityStoreContext(DataContext dataContext)
     : base(dataContext)
 {
     Secrets = new AppUserSecretStore(dataContext);
 }