Esempio n. 1
0
        public ActionResult Login(string username, string password)
        {
            if (string.IsNullOrEmpty(username))
            {
                ModelState.AddModelError("username", "请输入用户名");
                return(View());
            }

            if (string.IsNullOrEmpty(password))
            {
                ModelState.AddModelError("password", "请输入密码");
                return(View());
            }

            AuthBll bll = new AuthBll();

            sysmatchuser usr = bll.Login(username, password);

            if (usr == null)
            {
                ModelState.Clear();
                ModelState.AddModelError("error", "用户名密码不正确");
                return(View());
            }
            else
            {
                base.UserInfo = usr;

                return(RedirectToAction("Index", "Login", new { Area = "Auth" }));
            }
        }
        public async Task <IActionResult> Login(ParamLoginInfo loginInfo)
        {
            return(await ActionWrapAsync(async() =>
            {
                AuthBll auth = new AuthBll(_userService, HttpContext);
                ResultData <RpsLoginInfo> result = new ResultData <RpsLoginInfo>();
                result.Data = await auth.AuthUser(loginInfo);

                return result;
            }));
        }