public async Task <Checkout> GetOrCreateCheckout(int?checkoutId) { if (!checkoutId.HasValue) { return(await _checkoutRepository.AddAsync(new Checkout())); } var checkoutSpecification = new CheckoutWithUnitsSpecification(checkoutId.Value); var checkout = await _checkoutRepository.FirstAsync(checkoutSpecification); Guard.Against.Null(checkout, nameof(checkout)); return(checkout); }
public async Task <IEnumerable <Checkout> > GetCheckouts() { var checkoutSpecification = new CheckoutWithUnitsSpecification(); return(await _checkoutRepository.ListAsync(checkoutSpecification)); }