示例#1
0
        public async Task ValidateAsync(ICustomerContainer container)
        {
            if (container is null)
            {
                throw new ArgumentNullException(nameof(container));
            }

            var entity = await CustomerDataAccess.GetByAsync(container);

            if (entity is null)
            {
                throw new InvalidOperationException($"Customer not found by ID {container.CustomerId}");
            }
        }
示例#2
0
 public async Task <Customer> GetByAsync(ICustomerContainer container)
 {
     return(mapper.Map <Customer>(await context.Customers.FirstOrDefaultAsync(x => x.Id == container.CustomerId)));
 }