Beispiel #1
0
        public ActionResult SignUp(login_Signup ls)
        {
            if (ModelState.IsValid)
            {
                var check = new ChackUserToLogIn();
                var _id   = string.Empty;
                ls.Password     = new EncryptDecrypt().Encript(ls.Password);
                ls.FirstName    = ls.FirstName.ToLower();
                ls.LastName     = ls.LastName.ToLower();
                ls.EmailAddress = ls.EmailAddress.ToLower();
                dal.Users.Add(ls);
                dal.SaveChanges();

                var result = check.CheckUser(dal, ls.Password, ls.EmailAddress, out _id);

                if (result && _id != string.Empty)
                {
                    Session["UserID"] = Guid.NewGuid();
                }

                int id = int.Parse(_id);

                return(Redirect("/Orders/Orders/" + id));
            }
            else
            {
                return(View("LoginSignup"));
            }
        }
Beispiel #2
0
        public JsonResult CheckLogIn(string email, string pass)
        {
            var check = new ChackUserToLogIn();
            var id    = string.Empty;

            pass = new EncryptDecrypt().Encript(pass);

            var result = check.CheckUser(dal, pass, email, out id);
            var data   = new { result, id };

            if (data.result && data.id != string.Empty)
            {
                Session["UserID"] = Guid.NewGuid();
            }

            return(Json(data, JsonRequestBehavior.AllowGet));
        }