public IQueryable <Grade> GetAllGradeByProAndPassed(string proname, bool b) { GradeDal gradal = new GradeDal(); IQueryable <Grade> iq = null; if (b) { iq = gradal.GetEntities(u => u.Student.Profession.Pro_Name == proname && u.Score >= 60).OrderBy <Grade, int>(s => s.Score); } else { iq = gradal.GetEntities(u => u.Student.Profession.Pro_Name == proname && u.Score >= 60).OrderByDescending <Grade, int>(s => s.Score); } return(iq); }
/// <summary> /// 根据学生查询成绩 /// </summary> /// <param name="stu"></param> /// <returns></returns> public Grade GetGradeByStudent(Student stu) { Grade g = new Grade(); IQueryable <Grade> iq = gd.GetEntities(grade => grade.Student.Stu_Num == stu.Stu_Num); if (iq.Count() == 0) { return(null); } foreach (var item in iq) { g = item; } return(g); }
public ActionResult GetStuSou() { string key = Request["key"]; GradeDal studal = new GradeDal(); IQueryable <Grade> iq = studal.GetEntities(u => u.Student.Stu_Name.Contains(key) || u.Theme.Theme_Name.Contains(key) || u.Teacher.Tea_Name.Contains(key)); IList <string> strl = new List <string>(); foreach (var item in iq) { string s = item.Student.Stu_Name + "-" + item.Theme.Theme_Name + "-" + item.Teacher.Tea_Name + "-" + item.Score; strl.Add(s); } string str = js.Serialize(strl); Response.Write(str); Response.End(); return(View()); }