public ActionResult List(Admin admin) { AdminBLL adminBLL = new AdminBLL(); if (adminBLL.Login(admin.aUserName, admin.aPassword)) { BaseUserInfoBLL baseInfo = new BaseUserInfoBLL(); ViewData.Model = baseInfo.getUserList(); Response.Cookies["userName"].Value = admin.aUserName; Response.Cookies["userName"].Expires = DateTime.Now.AddDays(7); return View("List"); } else { return Content("登录失败"); } }
public ActionResult editAdmin(ChangeAdmin admin) { AdminBLL adminBLL = new AdminBLL(); if (!adminBLL.Login(admin.aUserName,admin.aPassword)) { return Content("修改失败,原密码错误"); } if (admin.aNewPassword!=admin.aReNewPassword) { return Content("修改失败,新密码两次输入不一致"); } if (!adminBLL.editAdmin(admin)) { return Content("修改失败"); } Response.Cookies["userName"].Expires = DateTime.Now; return RedirectToAction("Index"); }