public void Delete(IList <int> localIds, Guid districtId) { BaseSecurity.EnsureSysAdmin(Context); using (var uow = Update()) { var da = new SchoolDataAccess(uow); var schools = da.GetSchools(districtId, 0, int.MaxValue).ToList(); schools = schools.Where(x => localIds.Contains(x.LocalId)).ToList(); da.Delete(schools.Select(x => x.Id).ToList()); uow.Commit(); } }
public void Edit(IList <SchoolInfo> schoolInfos, Guid districtId) { BaseSecurity.EnsureSysAdmin(Context); using (var uow = Update()) { var da = new SchoolDataAccess(uow); var schools = da.GetSchools(districtId, 0, int.MaxValue).ToList(); schools = schools.Where(x => schoolInfos.Any(y => y.LocalId == x.LocalId)).ToList(); foreach (var school in schools) { var si = schoolInfos.FirstOrDefault(x => x.LocalId == school.LocalId); if (si != null) { school.IsChalkableEnabled = si.IsChalkableEnabled; school.IsLESyncComplete = si.IsLESyncComplete; school.IsLEEnabled = si.IsLEEnabled; school.Name = si.Name; } } da.Update(schools); uow.Commit(); } }