Beispiel #1
0
        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());
            }
        }
Beispiel #2
0
        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());
        }
Beispiel #3
0
 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());
         }
     }
 }
Beispiel #4
0
        public ActionResult Manage(CustomerModel customer)
        {
            GlobalCustomerListModel.RemoveCustomer();

            return(Redirect("/"));
        }