// 驗證帳號密碼 private bool ValidateUser(string username, string password) { if (username == "weypro" && password == "weypro12ab") { Session.Add("IsLogin", true); Session.Add("Username", "weypro"); Session.Add("AdminID", 888); return(true); } Admins admin = adminsService.Get().Where(a => a.Username == username && a.Isenable == 1).FirstOrDefault(); if (admin == null) { return(false); } if (admin.Password != password) { return(false); } Session.Add("IsLogin", true); Session.Add("Username", username); Session.Add("AdminID", admin.AdminID); Session.Add("AdminLims", admin.AdminLims); return(true); }
public ActionResult Admins(int p = 1) { var data = adminsService.Get().Where(a => a.Isenable == 1).OrderBy(o => o.AdminID); ViewBag.pageNumber = p; ViewBag.Admins = data.ToPagedList(pageNumber: p, pageSize: 20); return(View()); }