Esempio n. 1
0
        public ActionResult EditAccountInfo(CurrentUser currentUser, [Bind(Exclude = "TrueName")]Account model, string confirm)
        {
            Account account = db.Accounts.FirstOrDefault(x => x.UserName == currentUser.UserName);
            if (account == null) throw new Exception("系统异常!");

            ModelState.Remove("TrueName");

            if (!ModelState.IsValid) return View(account);

            if (model.Password.Trim().Length < 6)
                ModelState.AddModelError("Password", "密码长度不能低于6位");
            if (!string.Equals(model.Password, confirm))
                ModelState.AddModelError("Password", "密码不一致");

            if (!ModelState.IsValid) return View(account);

            account.Password = model.Password;
            db.SaveChanges();

            return RedirectToAction("ShowAccountInfo", new { code = "ZZ01" });
        }
 public ActionResult Quit(CurrentUser currentUser)
 {
     ViewBag.RoleCode = currentUser.RoleCode;
     return View();
 }
Esempio n. 3
0
 public ActionResult ShowCurrentAccountInfo(CurrentUser currentUser)
 {
     //currentUser.IP = Request.UserHostAddress;
     return View(currentUser);
 }
Esempio n. 4
0
 public ActionResult ShowAccountInfo(CurrentUser currentUser)
 {
     string userName = currentUser.UserName;
     var account = db.Accounts.FirstOrDefault(x => x.UserName == userName);
     return View(account);
 }