public ActionResult Index(LoginModel objuserlogin) { IList <Student> students = StuDbAccessor.SelectAll(); bool b = students.Any(x => x.Name.TrimEnd() == objuserlogin.UserName && x.Pwd.TrimEnd() == objuserlogin.UserPassword); if (b) { ViewBag.Status = "恭喜您登录成功!"; } else { ViewBag.Status = "用户名或密码错误!"; } return(View(objuserlogin)); }
public bool CheckStudent(string name, string pwd) { IList <Student> students = StuDbAccessor.SelectAll(); return(students.Any(x => x.Name.TrimEnd() == name && x.Pwd.TrimEnd() == pwd)); }
/// <summary> /// 根据是否特价查看 /// </summary> private void ViewAllStudent() { this.lstStudent = new BindingList <Student>(StuDbAccessor.SelectAll()); this.dgvStudents.DataSource = this.lstStudent; }