public async void RemoveAllForEvent(int eventId) { var list = await RepositoryDbSet .Where(item => item.EventId == eventId) .Select(e => AdministrativeUnitInEventMapper.MapFromDomain(e)).ToListAsync(); foreach (var item in list) { RepositoryDbSet.Remove(AdministrativeUnitInEventMapper.MapFromDAL(item)); } }
public async Task DeleteBranch(Sector sector) { if (sector.Children.Count > 0) { foreach (var child in sector.Children) { await DeleteBranch(child); } } RepositoryDbSet.Remove(sector); }
public void RemoveBySubjectEventAndTeacherIds(int subjectEventId, int teacherId) { RepositoryDbSet.Remove(RepositoryDbSet.First(entity => entity.TeacherId == teacherId && entity.SubjectInScheduleId == subjectEventId)); }