Esempio n. 1
0
 /// <summary>
 /// Add some albums to the specified user's cart.
 /// </summary>
 public static MvcMusicStore.Models.ShoppingCart AddItemsToCart(string userName, IEnumerable<Album> albums)
 {
     var cart = new MvcMusicStore.Models.ShoppingCart { ShoppingCartId = userName };
     cart.EmptyCart();
     foreach (var album in albums)
         cart.AddToCart(album);
     return cart;
 }
Esempio n. 2
0
 public static ShoppingCart FindShoppingCart()
 {
     var shoppingCartId = GetShoppingCartId(HttpContext.Current);
     var shoppingCart = MvcApplication.CurrentSession.Load<ShoppingCart>(shoppingCartId);
     if(shoppingCart == null)
     {
         shoppingCart = new ShoppingCart {Id = shoppingCartId};
         MvcApplication.CurrentSession.Store(shoppingCart);// in memory operation only
     }
     return shoppingCart;
 }
Esempio n. 3
0
        public static ShoppingCart GetCart(HttpContextBase context)
        {
            var ioc = new IoC();

            var cartAppService = ioc.Kernel.Get<ICartAppService>();
            var orderDetailAppService = ioc.Kernel.Get<IOrderDetailAppService>();
            var orderAppService = ioc.Kernel.Get<IOrderAppService>();

            var cart = new ShoppingCart(cartAppService, orderDetailAppService, orderAppService);
            cart.ShoppingCartId = cart.GetCartId(context);
            return cart;
        }
Esempio n. 4
0
 public static ShoppingCart GetCart(ICartIdProvider idProvider)
 {
     var cart = new ShoppingCart();
     cart.shoppingCartId = idProvider.GetCartId();
     return cart;
 }
Esempio n. 5
0
 public static ShoppingCart GetCart(HttpContextBase context)
 {
     var cart = new ShoppingCart();
     cart.ShoppingCartId = cart.GetCartId(context);
     return cart;
 }
Esempio n. 6
0
 public static ShoppingCart GetCart(MusicStoreEntities db, HttpContext context)
 {
     var cart = new ShoppingCart(db);
     cart.ShoppingCartId = cart.GetCartId(context);
     return cart;
 }
Esempio n. 7
0
 public static ShoppingCart GetCart(HttpContextBase httpContext, IMusicStoreContext storeContext)
 {
     var cart = new ShoppingCart(storeContext);
     cart.shoppingCartId = cart.GetCartId(httpContext);
     return cart;
 }