public async Task ValidateAsync(IBandContainer bandContainer) { if (bandContainer == null) { throw new ArgumentNullException(nameof(bandContainer)); } var concert = await this.GetBy(bandContainer); if (bandContainer.BandId.HasValue && concert == null) { throw new InvalidOperationException($"Concert not found by id {bandContainer.BandId}"); } }
public async Task <Band> GetByAsync(IBandContainer band) { return(band.BandId.HasValue ? this.Mapper.Map <Band>(await this.Context.Band.FirstOrDefaultAsync(x => x.Id == band.BandId)) : null); }
private Task <Band> GetBy(IBandContainer bandContainer) { return(this.BandDataAccess.GetByAsync(bandContainer)); }