Esempio n. 1
0
        public async Task <DatasetModel> GetByNameAsync(string name)
        {
            var dataset = await _datasetRepository.GetByNameAsync(name.ToLower());

            if (dataset == null)
            {
                throw new InvalidDataException($"Can't get Dataset with name {name}!");
            }
            return(_mapper.Map <DatasetModel>(dataset));
        }
Esempio n. 2
0
        public async Task RemoveDatasetAsync(int datasetId)
        {
            var definedDataset = await _definedDatasetRepository.GetByIdAsync(datasetId);

            var result = await _definedDatasetRepository.RemoveByIdAsync(datasetId);

            if (!result)
            {
                throw new InvalidDataException($"Can't delete Defined Dataset with id {datasetId} !");
            }

            var dataset = await _datasetRepository.GetByNameAsync(definedDataset.Name.ToLower());

            await _datasetRepository.RemoveByIdAsync(dataset.Id);

            await _uow.CommitAsync();
        }