コード例 #1
0
        public ActionResult dologin(string username, string password, string remName)
        {
            try
            {
                username = DataTypeHelper.StringFiltrate(username);
                password = DataTypeHelper.StringFiltrate(password);

                UsersDAL dal = new UsersDAL();
                UsersModel model = dal.login(username, password);
                if (model != null && model.ID > 0)
                {
                    LoginHandle.Login(model, remName);
                    return Content(true.ToResult(model).ToJsonString());
                }
                return Content(false.ToResult("用户名或密码错误").ToJsonString());
            }
            catch (Exception ex)
            {
                Log.Default.Error(ex);
                return Content(false.ToResult("网络错误,请稍后重试").ToJsonString());
            }
        }