Ejemplo n.º 1
0
 private static LookupResult <List <int> > GetItemsInCustomersBasketLINQ(string customerName)
 {
     return(
         from customerId in Datastore.GetCustomer(customerName)
         from basketId in Datastore.GetBasket(customerId)
         from items in Datastore.GetItemsInBasket(basketId)
         select items
         );
 }
Ejemplo n.º 2
0
        private static LookupResult <List <int> > GetItemsInCustomersBasket(string customerName)
        {
            var customerId = Datastore.GetCustomer(customerName);

            if (customerId.IsNothing)
            {
                return(LookupResult <List <int> > .Nothing);
            }
            else
            {
                var basketId = Datastore.GetBasket(customerId.Value);
                if (basketId.IsNothing)
                {
                    return(LookupResult <List <int> > .Nothing);
                }
                else
                {
                    var items = Datastore.GetItemsInBasket(basketId.Value);
                    return(items);
                }
            }
        }