Kooboo.Commerce.Carts.ShoppingCartService.FindByCustomerEmail C# (CSharp) Method

FindByCustomerEmail() public method

public FindByCustomerEmail ( string customerEmail ) : ShoppingCart
customerEmail string
return ShoppingCart
        public ShoppingCart FindByCustomerEmail(string customerEmail)
        {
            return Query().FirstOrDefault(c => c.Customer != null && c.Customer.Email == customerEmail);
        }

Usage Example

        public int GetCartIdByCustomer(string email)
        {
            var service = new Core.ShoppingCartService(_context.Instance);
            var cart    = service.FindByCustomerEmail(email);

            if (cart == null)
            {
                var customer = new Kooboo.Commerce.Customers.CustomerService(_context.Instance).FindByEmail(email);
                cart = Kooboo.Commerce.Carts.ShoppingCart.Create(customer);
                service.Create(cart);
            }

            return(cart.Id);
        }
All Usage Examples Of Kooboo.Commerce.Carts.ShoppingCartService::FindByCustomerEmail