Esempio n. 1
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            var customer = MainManager.Authenticate(txtFirstName.Text, txtLastName.Text);

            if (customer == null)
            {
                txtFirstName.Text = string.Empty;
                txtLastName.Text  = string.Empty;
                txtFirstName.Focus();
                return;
            }
            Session.Add("CustomerID", customer.ID);
            FormsAuthentication.RedirectFromLoginPage($"{customer.FirstName} {customer.LastName}", false);
        }
Esempio n. 2
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            var db = new MarinaEntities();

            var user = MainManager.Authenticate(txtFirstName.Text, txtLastName.Text);

            if (user == null)
            {
                var auth = new Customer
                {
                    FirstName = txtFirstName.Text,
                    LastName  = txtLastName.Text,
                    City      = txtCity.Text,
                    Phone     = txtPhone.Text
                };
                db.Customers.Add(auth);
            }


            db.SaveChanges();
            FormsAuthentication.SignOut();
            Response.Redirect("~/Login");
        }