public ActionResult Signup(Customer form) { if (ModelState.IsValid == false) { return View(form); } Customer newCustomer = new Customer { FirstName = form.FirstName, MiddleName = form.MiddleName, LastName = form.LastName, EmailAddress = form.EmailAddress, PhoneNumber = form.PhoneNumber, Password = form.Password, Address = form.Address, Role = "user" }; var customer = _dataContext.Customers.FirstOrDefault(c => c.EmailAddress == form.EmailAddress); if (customer != null) { ModelState.AddModelError("Email", "Email address must be unique!"); return View(form); } try { _dataContext.Customers.InsertOnSubmit(newCustomer); _dataContext.SubmitChanges(); } catch (Exception e) { Console.WriteLine(e); } return RedirectToRoute("Login"); }
partial void UpdateCustomer(Customer instance);
partial void DeleteCustomer(Customer instance);
partial void InsertCustomer(Customer instance);