public ActionResult Register(CustomerModel customer) { if (customer.IsValid(customer)) { GlobalCustomerListModel.Add(customer); GlobalCustomerListModel.CurrentUser = customer; ViewBag.Message = "Successfully registered and logged in!"; return(Redirect("/")); } else { ViewBag.Message = "Error! Please Enter Valid Information"; return(View()); } }
public ActionResult Recover(CustomerModel customer) { var client = new SendGridClient("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"); var msg = new SendGridMessage() { From = new EmailAddress("*****@*****.**", "Mama Jane's Pizza"), Subject = "Account Password Reset", HtmlContent = "Reset your password by <a href='https://localhost:44302/Login/Reset'>clicking here</a>" }; msg.AddTo(new EmailAddress(customer.Email)); client.SendEmailAsync(msg); ViewBag.Message = "Email Sent!"; GlobalCustomerListModel.CurrentUser = GlobalCustomerListModel.SearchByEmail(customer.Email); return(View()); }
public ActionResult Index(CustomerModel customer) { if (String.IsNullOrEmpty(customer.Email) || String.IsNullOrEmpty(customer.Password)) { ViewBag.Message = "Error! Please Enter Both Email and Password"; return(Redirect("/Login")); } else { CustomerModel user = GlobalCustomerListModel.SearchByEmail(customer.Email); if (user != null) { GlobalCustomerListModel.CurrentUser = user; ViewBag.Message = "Successfully logged in!"; return(Redirect("/")); } else { ViewBag.Message = "Error! Email or Password invalid"; return(View()); } } }
public ActionResult Manage(CustomerModel customer) { GlobalCustomerListModel.RemoveCustomer(); return(Redirect("/")); }