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}"); } }
private Task <Podcast> GetBy(IPodcastContainer departmentContainer) { return(this.PodcastDataAccess.GetByAsync(departmentContainer)); }
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); }