コード例 #1
0
        public async Task <IEnumerable <DatasetModel> > GetDatasetsByTypeNameAsync(string name)
        {
            var type = await _fieldTypeRepository.GetByNameAsync(name.ToLower());

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

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