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}"); } }
public async Task <Customer> GetByAsync(ICustomerContainer container) { return(mapper.Map <Customer>(await context.Customers.FirstOrDefaultAsync(x => x.Id == container.CustomerId))); }