public IList <ClassStandard> AddClassStandards(IList <ClassStandard> classStandards) { if (!BaseSecurity.IsSysAdmin(Context)) { throw new ChalkableSecurityException(); } return(ClassStandardStorage.Add(classStandards)); }
private void InsertDefaultClassStandards() { var standardsIds = StandardStorage.GetData().Keys.ToList(); var classStandards = ClassStandardStorage.GetAll(); standardsIds = standardsIds.Where(x => classStandards.All(y => y.StandardRef != x)).ToList(); var classes = ServiceLocator.ClassService.GetAll(); var newClassStandards = new List <ClassStandard>(); foreach (var c in classes) { newClassStandards.AddRange(standardsIds.Select(id => new ClassStandard { ClassRef = c.Id, StandardRef = id }).ToList()); } ClassStandardStorage.Add(newClassStandards); }