Пример #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);
     }
 }
Пример #2
0
 public void DeleteShoppingCart(string shoppingCartId)
 {
     try
     {
         var context      = new ShoppingCartContext();
         var shoppingCart = context.Get(shoppingCartId);
         if (shoppingCart != null)
         {
             context.Delete(shoppingCart);
         }
     }
     catch (Exception e)
     {
         throw new RepositoryException(
                   string.Format(CultureInfo.CurrentCulture, Strings.ErrorDeletingShoppingCart, shoppingCartId),
                   e);
     }
 }