Пример #1
0
        protected void CreateUser_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                using (humbleEntities cont = new humbleEntities())
                {
                    var fn    = fnBox.Text;
                    var ln    = lnBox.Text;
                    var email = mailBox.Text;
                    var age   = ageBox.Text;
                    var passw = passBox.Text;
                    var of    = chkBox.Checked;

                    Customer newCustomer = new Customer();
                    newCustomer.FirstName = fn;
                    newCustomer.LastName  = ln;
                    newCustomer.Email     = email;
                    newCustomer.Age       = Convert.ToInt32(age);
                    newCustomer.Pass      = passw;
                    newCustomer.Offers    = of;

                    cont.Customers.Add(newCustomer);
                    Response.Redirect("RegistrationSuccess.aspx");
                }
            }
        }
Пример #2
0
        protected void loginbutton_Click(object sender, EventArgs e)
        {
            var email = emailBox.Text;
            var pass  = passBox.Text;

            using (humbleEntities conn = new humbleEntities())
            {
                Customer customer = conn.Customers.FirstOrDefault(x => x.Pass == passBox.Text && x.Email == emailBox.Text);
                Session["currentCustomer"] = customer;
                FormsAuthentication.SetAuthCookie(customer.Email, false);
                Response.Redirect("Browse.aspx");
            }
        }