public ActionResult AddUserToDB(LoginModel model) { SetCookies(model); User userDetails = DALayer.AddNewUser(model); DALayer.UpsertTokenValue(model.Token, model.Email); SetProperty(SessionVariableNames.Current_User, userDetails); return(RedirectToAction("Index", "Home")); }
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)); }