public ActionResult Create(CustomerInformation account)
 {
     var newAccount = CustomerInformation.CreateCustomerInformation(account.CustomerName, User.Identity.GetUserName(), account.Address);
     if (newAccount != null)
     {
         return RedirectToAction("Detail", new { id = newAccount.EmailAddress.Replace(".", "~") });
     }
     return View();
 }
        public static CustomerInformation CreateCustomerInformation(string customerName, string customerEmailAddress, string customerAddress)
        {
            using (var db = new CustomerModel())
            {
                if (!accountsLoaded)
                {
                    //This increments based on the count of rows.
                    lastAccountNumber = db.CustomerInformations.Count();
                    accountsLoaded    = true;
                }

                CustomerInformation customerAccount = new CustomerInformation();
                customerAccount.CustomerName = customerName;
                customerAccount.EmailAddress = customerEmailAddress;
                customerAccount.Address      = customerAddress;

                customerInformations.Add(customerAccount);
                db.CustomerInformations.Add(customerAccount);
                db.SaveChanges();

                return(customerAccount);
            }
        }
        public static CustomerInformation CreateCustomerInformation(string customerName, string customerEmailAddress, string customerAddress)
        {
            using (var db = new CustomerModel())
            {
                if (!accountsLoaded)
                {
                    //This increments based on the count of rows.
                    lastAccountNumber = db.CustomerInformations.Count();
                    accountsLoaded = true;
                }

                CustomerInformation customerAccount = new CustomerInformation();
                customerAccount.CustomerName = customerName;
                customerAccount.EmailAddress = customerEmailAddress;
                customerAccount.Address = customerAddress;

                customerInformations.Add(customerAccount);
                db.CustomerInformations.Add(customerAccount);
                db.SaveChanges();

                return customerAccount;
            }
        }