예제 #1
0
        public async Task <bool> ClearGroupForUnitsAsync(int departmentGroupId, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (departmentGroupId <= 0)
            {
                throw new ArgumentException("DepartmentGroupId cannot be null", "departmentGroupId");
            }

            var units = await _unitsRepository.GetAllUnitsByGroupIdAsync(departmentGroupId);

            foreach (var unit in units)
            {
                unit.StationGroupId = null;
                unit.StationGroup   = null;


                await _unitsRepository.SaveOrUpdateAsync(unit, cancellationToken);
            }

            return(true);
        }