Beispiel #1
0
        public async Task AddSeriesAsync(SeriesInputDto seriesDto)
        {
            var series    = _mapper.Map <Data.Series>(seriesDto);
            var publisher = await _publisherRepository.GetByIdAsync(seriesDto.PublisherId).ConfigureAwait(true);

            if (publisher == null)
            {
                throw new ValidationException("Invalid publisher id.");
            }

            series.Validate();

            if (series.HasErrors)
            {
                throw new ValidationException(series.GetFirstError());
            }

            await _repository.AddAsync(series).ConfigureAwait(true);
        }
Beispiel #2
0
        public async Task <PublisherDetailsDto> PublisherDetailsAsync(int id)
        {
            var publisher = await _repository.GetByIdAsync(id).ConfigureAwait(true);

            return(_mapper.Map <PublisherDetailsDto>(publisher));
        }