/// <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; }
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; }
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; }
public static ShoppingCart GetCart(ICartIdProvider idProvider) { var cart = new ShoppingCart(); cart.shoppingCartId = idProvider.GetCartId(); return cart; }
public static ShoppingCart GetCart(HttpContextBase context) { var cart = new ShoppingCart(); cart.ShoppingCartId = cart.GetCartId(context); return cart; }
public static ShoppingCart GetCart(MusicStoreEntities db, HttpContext context) { var cart = new ShoppingCart(db); cart.ShoppingCartId = cart.GetCartId(context); return cart; }
public static ShoppingCart GetCart(HttpContextBase httpContext, IMusicStoreContext storeContext) { var cart = new ShoppingCart(storeContext); cart.shoppingCartId = cart.GetCartId(httpContext); return cart; }