Пример #1
0
        public async Task <ActionResult <IReadOnlyList <ItemDto> > > GetItems([FromQuery] int budgetGroupId)
        {
            if (!_repo.BudgetGroupByBudgetGroupIdExists(budgetGroupId))
            {
                _logger.LogError($"Unable to find BudgetGroup with the BudgetGroupId '{budgetGroupId}'.");
                return(NotFound());
            }

            IReadOnlyList <Item> item = await _repo.GetItemsAsync(budgetGroupId);

            _logger.LogInformation($"Returned all Items associated with the BudgetGroupId '{budgetGroupId}'.");
            return(Ok(_mapper.Map <IReadOnlyList <ItemDto> >(item)));
        }