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

            var rider = await this.GetBy(riderContainer);

            if (riderContainer.RiderId.HasValue && rider == null)
            {
                throw new InvalidOperationException($"Rider not found by id {riderContainer.RiderId}");
            }
        }
Exemplo n.º 2
0
 private Task <Rider> GetBy(IRiderContainer departmentContainer)
 {
     return(this.RiderDataAccess.GetByAsync(departmentContainer));
 }
Exemplo n.º 3
0
 public async Task <Rider> GetByAsync(IRiderContainer rider)
 {
     return(rider.RiderId.HasValue
         ? this.Mapper.Map <Rider>(await this.Context.Rider.FirstOrDefaultAsync(x => x.Id == rider.RiderId))
         : null);
 }