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); } }
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); } }