Ejemplo n.º 1
0
        public async Task <IEnumerable <DatasetModel> > GetDatasetsByTypeIdAsync(int id)
        {
            var type = await _fieldTypeRepository.GetByIdAsync(id);

            if (type == null)
            {
                throw new InvalidDataException($"Can't get Type with id {id}!");
            }
            var datasets = type.Name.ToLower() != "enum" ? await _datasetRepository.GetDatasetsByTypeIdAsync(id) : await _datasetRepository.GetAllAsync();

            if (datasets == null)
            {
                throw new InvalidDataException($"Can't get Datasets with Type id {id}!");
            }
            return(_mapper.Map <IEnumerable <DatasetModel> >(datasets));
        }