Esempio n. 1
0
        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}");
            }
        }
Esempio n. 2
0
 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);
 }
Esempio n. 3
0
 private Task <Band> GetBy(IBandContainer bandContainer)
 {
     return(this.BandDataAccess.GetByAsync(bandContainer));
 }