コード例 #1
0
        public IActionResult Index()
        {
            /// /// <summary>        /// 将byte数组转换成对象        /// </summary>     
            var sss = ByteConvertHelper.Bytes2Object <UserModel>(HttpContext.Session.Get("User"));

            ViewBag.GG = sss.UserName;
            //  sendEmail();
            return(View());
        }
コード例 #2
0
        public IActionResult Index()
        {
            var typeList = con.GetTypeList();

            ViewBag.typeList = typeList;
            var sss = ByteConvertHelper.Bytes2Object <UserModel>(HttpContext.Session.Get("User"));

            ViewBag.UserId = sss.Id;
            return(View());
        }
コード例 #3
0
        public IActionResult Leave()
        {
            var sss = ByteConvertHelper.Bytes2Object <UserModel>(HttpContext.Session.Get("User"));

            ViewBag.UserId   = sss.Id;
            ViewBag.UserName = sss.UserName;
            var userList = new getUserList().getData();

            ViewBag.userList = userList;
            return(View());
        }
コード例 #4
0
ファイル: LoginController.cs プロジェクト: bigdee0621/STCOA
 public IActionResult SignIn(UserModel userModel)
 {
     if (ModelState.IsValid)
     {
         //检查用户信息
         UserAppService obj     = new UserAppService();
         var            isLogin = obj.Login(userModel.Username, userModel.Password);
         if (isLogin != null)
         {
             //记录Session
             HttpContext.Session.Set("User", ByteConvertHelper.Object2Bytes(isLogin));
             //跳转到系统首页
             return(RedirectToAction("Index", "Home"));
         }
         ViewBag.ErrorInfo = "用户名或密码错误";
         return(View(userModel));
     }
     ViewBag.ErrorInfo = ModelState.Values.First().Errors[0].ErrorMessage;
     return(View(userModel));
 }