Exemplo n.º 1
0
 public ActionResult Index(UserInfo userInfo, LoginModel login, string returnUrl)
 {
     string redirectUrl = returnUrl ?? Url.Action("Index", "Home");
     ActionResult redirect;
     if (ValidateUserNamePasswordLogin(login, redirectUrl, out redirect))
     {
         userInfo.Name = login.Name;
         userInfo.UserName = login.UserName;
         return redirect;
     }
     return RedirectToAction("Fail");
 }
Exemplo n.º 2
0
 public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
 {
     UserInfo userModel = null;
     if (controllerContext.HttpContext.Session != null)
     {
         userModel = controllerContext.HttpContext.Session[UserInfoSessionKey] as UserInfo;
     }
     if (userModel == null)
     {
         userModel = new UserInfo();
         if (controllerContext.HttpContext.Session != null)
         {
             controllerContext.HttpContext.Session[UserInfoSessionKey] = userModel;
         }
     }
     return userModel;
 }