Exemplo n.º 1
0
        public async Task ValidateAsync(IPodcastContainer podcastContainer)
        {
            if (podcastContainer == null)
            {
                throw new ArgumentNullException(nameof(podcastContainer));
            }

            var album = await this.GetBy(podcastContainer);

            if (podcastContainer.PodcastId.HasValue && album == null)
            {
                throw new InvalidOperationException($"Album not found by id {podcastContainer.PodcastId}");
            }
        }
Exemplo n.º 2
0
 private Task <Podcast> GetBy(IPodcastContainer departmentContainer)
 {
     return(this.PodcastDataAccess.GetByAsync(departmentContainer));
 }
Exemplo n.º 3
0
 public async Task <Podcast> GetByAsync(IPodcastContainer podcast)
 {
     return(podcast.PodcastId.HasValue
         ? this.Mapper.Map <Podcast>(await this.Context.Podcast.FirstOrDefaultAsync(x => x.Id == podcast.PodcastId))
         : null);
 }