Beispiel #1
0
        public async Task <List <Unit> > GetUnitsForDepartmentAsync(int departmentId)
        {
            List <Unit> systemUnts = new List <Unit>();
            var         units      = (await _unitsRepository.GetAllByDepartmentIdAsync(departmentId)).ToList();

            int limit = (await _subscriptionsService.GetCurrentPlanForDepartmentAsync(departmentId)).GetLimitForTypeAsInt(PlanLimitTypes.Units);
            int count = units.Count < limit ? units.Count : limit;

            // Only return units up to the plans unit limit
            for (int i = 0; i < count; i++)
            {
                systemUnts.Add(units[i]);
            }

            return(systemUnts);
        }