コード例 #1
0
 public ActionResult Login(LoginModel model)
 {
     if (!string.IsNullOrEmpty(model.UserName) && !string.IsNullOrEmpty(model.Password))
     {
         var userBll        = new AdminUserBLL();
         var loginUserModel = userBll.GetLoginUserByLogin(model.UserName, model.Password);
         if (loginUserModel != null)
         {
             if (loginUserModel.AdminUserInfo.Status != 1)
             {
                 model.ErrorInfoForUserName = "******";
             }
             else if (loginUserModel.MenuList != null && loginUserModel.MenuList.Count > 0)
             {
                 LoginHelper.Cache(loginUserModel);
                 if (string.IsNullOrEmpty(model.ReturnUrl))
                 {
                     return(RedirectToAction("Index", "Home"));
                 }
                 else
                 {
                     return(Redirect(model.ReturnUrl));
                 }
             }
             else
             {
                 model.ErrorInfoForUserName = "******";
             }
         }
         else
         {
             model.ErrorInfoForUserName = "******";
         }
     }
     else
     {
         model.ErrorInfoForUserName = "******";
         model.ErrorInfoForPassword = "******";
     }
     return(View(model));
 }