Esempio n. 1
0
 public ShoppingCart GetShoppingCart(string shoppingCartId)
 {
     try
     {
         var storedCart = new ShoppingCartContext().Get(shoppingCartId);
         return(storedCart != null?ShoppingCartMapper.Map(storedCart) : new ShoppingCart(shoppingCartId));
     }
     catch (Exception e)
     {
         throw new RepositoryException(
                   string.Format(CultureInfo.CurrentCulture, Strings.ErrorRetrievingShoppingCartById, shoppingCartId),
                   e);
     }
 }
Esempio n. 2
0
        public ShoppingCart SaveShoppingCart(ShoppingCart shoppingCart)
        {
            if (shoppingCart == null)
            {
                throw new ArgumentNullException("shoppingCart");
            }

            try
            {
                new ShoppingCartContext().Save(ShoppingCartMapper.Map(shoppingCart));
                return(shoppingCart);
            }
            catch (Exception e)
            {
                throw new RepositoryException(
                          string.Format(CultureInfo.CurrentCulture, Strings.ErrorSavingShoppingCart, shoppingCart.UserCartId, shoppingCart.TrackingId),
                          e);
            }
        }