public ActionResult Create([Bind(Include = "CustomerID,FirstName,LastName,Username,Password,Gender,AccessLevel")] Customer customer) { if (ModelState.IsValid) { string salt = Crypto.GenerateSalt(); string hash = hashString(salt + customer.Password); int hashLength = hash.Length; int saltLength = salt.Length; if (customer.AccessLevel == null) { customer.AccessLevel = "U"; } if (customer.FirstName == null || customer.LastName == null || customer.Username == null || customer.Password == null || customer.Gender == null) { return(View()); } db.usp_AddCustomer(customer.FirstName, customer.LastName, customer.Username, hash, customer.Gender, customer.AccessLevel, salt); FormsAuthentication.SetAuthCookie(customer.Username, false); return(RedirectToAction("Index", "Home", null)); } return(View(customer)); }