Exemplo n.º 1
0
        public ActionResult LogOn(LogOnModel model)
        {
            if (ModelState.IsValid)
            {
                AdminUser admin;
                if (AdminService.Validate(model.UserName, model.Password, out admin))
                {
                    FormsService.SignIn(model.UserName, false);

                    admin.LoginIP = Utility.GetIP();
                    admin.LoginTime = DateTime.Now;
                    AdminService.UpdateEntity(admin);

                    IoC.Resolve<IAdminLogService>().AddAdminLog(admin, admin.UserName + "登陆成功", "/Account/LogOn", admin.LoginIP);

                    return RedirectToAction("Index", "Home");
                }
                ModelState.AddModelError("", "您输入的用户名和密码无效!");
            }

            return View(model);
        }
Exemplo n.º 2
0
 public ActionResult LogOn()
 {
     var model = new LogOnModel();
     return View(model);
 }