public ActionResult Index()
        {
            string emailId = GetEmailIdAndRefreshUserSession(true);

            if (emailId != null)
            {
                bool exists = DALayer.IsEmailPresentInDB(emailId);
                if (!exists)
                {
                    return(RedirectToAction("Login", "Login"));
                }
            }

            return(View());
        }
Beispiel #2
0
        public ActionResult Login(LoginModel loginModel)
        {
            if (loginModel != null)
            {
                SetProperty(SessionVariableNames.Login_Model, loginModel);
                SetProperty(SessionVariableNames.Email_Id, loginModel.Email);
                bool exists = DALayer.IsEmailPresentInDB(loginModel.Email);
                if (exists)
                {
                    DALayer.UpsertTokenValue(loginModel.Token, loginModel.Email);
                    DALayer.UpdateImageUrl(loginModel.Email, loginModel.ImageUrl);
                    SetCookies(loginModel);
                    return(Json(new { result = "Redirect", url = Url.Action("Index", "Home") }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(new { result = "Add", url = Url.Action("AddUserDetails", "Login", JsonRequestBehavior.AllowGet) }));
                }
            }

            return(Json(new { result = "Error" }, JsonRequestBehavior.AllowGet));
        }