Пример #1
0
 public IList <Standard> GetStandards(int?classId, int?gradeLevelId, int?subjectId, int?parentStandardId = null, bool allStandards = true, bool activeOnly = false)
 {
     using (var uow = Read())
     {
         var res = new StandardDataAccess(uow).GetStandards(new StandardQuery
         {
             ClassId           = classId,
             GradeLavelId      = gradeLevelId,
             StandardSubjectId = subjectId,
             ParentStandardId  = parentStandardId,
             AllStandards      = allStandards,
             ActiveOnly        = activeOnly
         });
         return(res.OrderBy(x => x.Name).ToList());
     }
 }
Пример #2
0
        public IList <Standard> GetStandards(string filter, int?classId, bool activeOnly = false, bool?deepest = null)
        {
            IList <Standard> standards;

            using (var uow = Read())
            {
                var da = new StandardDataAccess(uow);
                standards = da.SearchStandards(filter, activeOnly);
                if (classId.HasValue)
                {
                    var standardsByClass = da.GetStandards(new StandardQuery {
                        ClassId = classId, ActiveOnly = activeOnly, AllStandards = true
                    });
                    standards = standards.Where(s => standardsByClass.Any(s2 => s2.Id == s.Id)).ToList();
                }
                if (deepest.HasValue)
                {
                    standards = standards.Where(x => x.IsDeepest = deepest.Value).ToList();
                }
            }
            return(standards);
        }