Exemple #1
0
 private void InitializeDb()
 {
     using (var context = new SpeakcoreContext())
     {
         var dbInitializer = new SpeakcoreDatabaseInitializer();
         dbInitializer.InitializeDatabase(context);
         Database.SetInitializer(dbInitializer);
     }
 }
Exemple #2
0
        protected void RegisterAccount(AccountModel account)
        {
            bool allowRegistration = false;

            using (var context = new SpeakcoreContext())
            {
                if (!context.AccountModels.Any(a => a.EmailAddress == account.EmailAddress))
                {
                    allowRegistration = true;
                    context.AccountModels.Add(account);
                    context.SaveChanges();
                }
                else
                {
                    FailureText.Text     = "The entered email address has already been registered";
                    ErrorMessage.Visible = true;
                }
            }

            if (allowRegistration)
            {
                Response.Redirect($"/{Routes.Confirmation}");
            }
        }