Пример #1
0
        public ActionResult Registeraction(Customermodel model)
        {
            if (model.Password != model.ConfirmPassword)
            {
                ModelState.AddModelError("Password", "The confirm password does not match");
                ModelState.AddModelError("ConfirmPassword", "The password does not match");
            }

            if (ModelState.IsValid)
            {
                UIADbEntities db              = new UIADbEntities();
                string        firstname       = model.FirstName;
                string        lastname        = model.LastName;
                string        password        = model.Password;
                string        confirmpassword = model.ConfirmPassword;
                string        email           = model.Email;
                var           newcus          = db.RegisterAccount(firstname, lastname, password, email);
                var           result          = newcus.FirstOrDefault();
                if (result.Equals("Repeated Email"))
                {
                    ModelState.AddModelError("Email", "The email has been registered by another account!");
                }
                else
                {
                    return(View("Login"));
                }
            }
            return(View("Register"));
        }
Пример #2
0
        public JsonResult Loginaction(string Email, string Password)
        {
            UIADbEntities db     = new UIADbEntities();
            var           cus    = db.GetCustomerLogin(Email, Password);
            var           result = cus.FirstOrDefault();

            return(Json(new { id = result }, JsonRequestBehavior.AllowGet));
        }
Пример #3
0
        public ActionResult Testing()
        {
            string username = Request.Form["emailaddressinput"];
            string password = Request.Form["passwordinput"];

            ViewBag.Email = username;
            ViewBag.Pass  = password;
            UIADbEntities entities = new UIADbEntities();

            return(View(from Customer in entities.Customers.Take(10) select Customer));
        }