public IEnumerable <SchoolView> GetSchoolWithNotSub(string term) { //删除未征订的订单 RemoveNotSubscription(); _subscriptionRepo.Context.Commit(); //比较器 var comparer = new SchoolComparer(); //取未征订申报的学院 var studentSchools = GetNotSubscriptionStudentDeclarationJiaoWu(term) .Select(t => t.School) .Distinct(comparer); //去除重复学院 var teacherSchools = GetNotSubscriptionTeacherDeclarationJiaoWu(term) .Select(t => t.School) .Distinct(comparer); //去除重复学院 //合并学院 var unionSchools = studentSchools .Union(teacherSchools); //取学院 var schools = unionSchools .Distinct(comparer) .OrderBy(t => t.Name) //按学院名称排序 .ToList(); //检查 if (schools.Count() == 0) { schools = new List <School>() { new School() { ID = Guid.Empty, Name = "没有未下订单的学院" } }; } return(_adapter.Adapt <SchoolView>(schools)); }
public IEnumerable<SchoolView> GetSchoolWithNotSub(string term) { //删除未征订的订单 RemoveNotSubscription(); _subscriptionRepo.Context.Commit(); //比较器 var comparer = new SchoolComparer(); //取未征订申报的学院 var studentSchools = GetNotSubscriptionStudentDeclarationJiaoWu(term) .Select(t => t.School) .Distinct(comparer); //去除重复学院 var teacherSchools = GetNotSubscriptionTeacherDeclarationJiaoWu(term) .Select(t => t.School) .Distinct(comparer); //去除重复学院 //合并学院 var unionSchools = studentSchools .Union(teacherSchools); //取学院 var schools = unionSchools .Distinct(comparer) .OrderBy(t => t.Name) //按学院名称排序 .ToList(); //检查 if (schools.Count() == 0) { schools = new List<School>() { new School() { ID=Guid.Empty, Name="没有未下订单的学院" } }; } return _adapter.Adapt<SchoolView>(schools); }