Ejemplo n.º 1
0
        public JsonResult LoginSys(String Email, String Password)
        {
            //this method will check user with given email and password exists and if so logged the user
            HomeService service     = new HomeService();
            var         UserDetails = service.CheckUserExits(Email, Password);

            //Create Log on session
            if ((UserDetails == null))
            {
                //No User
                return(Json(new { Status = false, Message = "Incorrect Email or Password..." }, JsonRequestBehavior.AllowGet));
            }
            else if (UserDetails.UserId == -1)
            {   //Network Issue
                return(Json(new { Status = false, Message = "Check Your Connection..." }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                //create session and redirect to logged home or shop page
                SetLogOnSessionModel(UserDetails);
                Session[SessionConstants.SESSION_CONTEXT_INSTANCE] = UserDetails;
                return(Json(new { Status = true, Message = "Successfully logged in..." }, JsonRequestBehavior.AllowGet));
            }
        }