Beispiel #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WishListOperationsController"/> class.
 /// </summary>
 public WishListOperationsController()
 {
     if (CurrentCustomer != null)
     {
         _wishList = ((ICustomer)CurrentCustomer).WishList();
     }
 }
Beispiel #2
0
 public DetailModel(UserManager <User> userManager,
                    TuplaContext context,
                    IGame db,
                    IGamePicture picdb,
                    IGameTag dbgametag,
                    IPlatform platformdb,
                    IPlatformOfGame gamePlatformdb,
                    ITag dbTag,
                    IWishList wishdb,
                    ITransaction transdb,
                    IOrderDetail orderdetaildb,
                    IReview reviewdb,
                    ICustomerPicture userpicdb)
 {
     this.userManager    = userManager;
     this.context        = context;
     this.db             = db;
     this.picdb          = picdb;
     this.dbgametag      = dbgametag;
     this.platformdb     = platformdb;
     this.gamePlatformdb = gamePlatformdb;
     this.dbTag          = dbTag;
     this.wishdb         = wishdb;
     this.transdb        = transdb;
     this.orderdetaildb  = orderdetaildb;
     this.reviewdb       = reviewdb;
     this.userpicdb      = userpicdb;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="BazaarWishListController"/> class.
 /// </summary>
 public BazaarWishListController()
 {
     if (CurrentCustomer != null)
     {
         _wishList = ((ICustomer)CurrentCustomer).WishList();
     }
 }
        /// <summary>
        /// Moves the wish list to the basket.
        /// </summary>
        /// <param name="wishList">
        /// The wish list.
        /// </param>
        public static void MoveToBasket(this IWishList wishList)
        {
            var basket = wishList.Customer.Basket();

            basket.Items.Add(wishList.Items.Select(x => x.AsLineItemOf <ItemCacheLineItem>()));
            basket.Save();

            wishList.Empty();
        }
Beispiel #5
0
        /// <summary>
        /// Saves the wish list.
        /// </summary>
        /// <param name="merchelloContext">
        /// The merchello context.
        /// </param>
        /// <param name="wishlist">
        /// The wish list.
        /// </param>
        internal static void Save(IMerchelloContext merchelloContext, IWishList wishlist)
        {
            // Update the wishlist item cache version so that it can be validated in the checkout
            ((WishList)wishlist).VersionKey = Guid.NewGuid();

            merchelloContext.Services.ItemCacheService.Save(((WishList)wishlist).ItemCache);

            Refresh(merchelloContext, wishlist);
        }
 public WishlistModel(UserManager <Areas.Identity.Data.User> userManager,
                      IWishList wishlistdb,
                      IGame gamedb,
                      IGamePicture gamepicdb)
 {
     this.userManager = userManager;
     this.wishlistdb  = wishlistdb;
     this.gamedb      = gamedb;
     this.gamepicdb   = gamepicdb;
 }
        public IActionResult SearchWishList_Products(int id, string search)
        {
            List <APIUsers.Library.Models.Product> listProducts = new List <APIUsers.Library.Models.Product>();

            using (IWishList WishList = Factorizador.CrearConexionServicioWishList(ConnectionType.MSSQL, ConnectionStringLocal))
            {
                listProducts = WishList.searchProducts_Wishlist(search, id);
            }
            return(Ok(new { listProducts }));
        }
        public int RemovefromWishList([FromBody] APIUsers.Library.Models.WishList wishList)
        {
            int id = 0;

            using (IWishList WishList = Factorizador.CrearConexionServicioWishList(ConnectionType.MSSQL, ConnectionStringLocal))
            {
                id = WishList.removeFromWishList(wishList.ID_User, wishList.ID_Product);
            }
            return(id);
        }
Beispiel #9
0
        /// <summary>
        /// Refreshes the runtime cache
        /// </summary>
        /// <param name="merchelloContext">The merchello context</param>
        /// <param name="wishlist">The <see cref="IWishList"/></param>
        public static void Refresh(IMerchelloContext merchelloContext, IWishList wishlist)
        {
            var cacheKey = MakeCacheKey(wishlist.Customer);

            merchelloContext.Cache.RuntimeCache.ClearCacheItem(cacheKey);

            var customerItemCache = merchelloContext.Services.ItemCacheService.GetItemCacheWithKey(wishlist.Customer, ItemCacheType.Wishlist);

            wishlist = new WishList(customerItemCache, wishlist.Customer);
            merchelloContext.Cache.RuntimeCache.GetCacheItem(cacheKey, () => wishlist);
        }
        public IEnumerable <Product> GetWishList_Products_ByOrder(int id, string order)
        {
            List <Product> listProducts = new List <Product>();

            using (IWishList WishList = Factorizador.CrearConexionServicioWishList(ConnectionType.MSSQL, ConnectionStringLocal))
            {
                listProducts = WishList.getProducts_Wishlist_ByOrder(id, order);
            }

            return(listProducts);
        }
        public InMemoryWishListTest()
        {
            _systemClockMock = new Mock <ISystemClock>();
            _options         = new InMemoryWishListOptions
            {
                SystemClock         = _systemClockMock.Object,
                ExpirationInSeconds = 30
            };
#if TEST_InMemoryWishListRefactored
            sut = new InMemoryWishListRefactored(_options);
#else
            sut = new InMemoryWishList(_options);
#endif
        }
        /// <summary>
        /// Moves the wish list to the basket.
        /// </summary>
        /// <param name="wishList">
        /// The wish list.
        /// </param>
        /// <param name="lineItemKey">
        /// The line Item Key.
        /// </param>
        public static void MoveItemToBasket(this IWishList wishList, Guid lineItemKey)
        {
            var lineItem = wishList.Items.FirstOrDefault(x => x.Key == lineItemKey);

            if (lineItem == null)
            {
                return;
            }

            var basket = wishList.Customer.Basket();

            basket.AddItem(lineItem.AsLineItemOf <ItemCacheLineItem>());
            basket.Save();

            wishList.RemoveItem(lineItem.Key);
            wishList.Save();
        }
Beispiel #13
0
        public static IWishList CrearConexionServicioWishList(Models.ConnectionType type, string connectionString)
        {
            IWishList nuevoMotor = null;;

            switch (type)
            {
            case Models.ConnectionType.NONE:
                break;

            case Models.ConnectionType.MSSQL:
                SqlConexion sql = SqlConexion.Conectar(connectionString);
                nuevoMotor = WishListService.CrearInstanciaSQL(sql);
                break;

            case Models.ConnectionType.MYSQL:

                break;

            default:
                break;
            }

            return(nuevoMotor);
        }
 public WishlistController(IWishList wishList, IMapper mapper)
 {
     _wishlist = wishList;
     _mapper   = mapper;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="BazaarWishListController"/> class.
 /// </summary>
 public BazaarWishListController()
 {
     if (CurrentCustomer != null) _wishList = ((ICustomer)CurrentCustomer).WishList();
 }
Beispiel #16
0
 /// <summary>
 /// Empties the wish list.
 /// </summary>
 /// <param name="merchelloContext">
 /// The merchello context.
 /// </param>
 /// <param name="wishlist">
 /// The wish list.
 /// </param>
 internal static void Empty(IMerchelloContext merchelloContext, IWishList wishlist)
 {
     wishlist.Items.Clear();
     Save(merchelloContext, wishlist);
 }
        /// <summary>
        /// Moves the wish list to the basket.
        /// </summary>
        /// <param name="wishList">
        /// The wish list.
        /// </param>
        /// <param name="sku">
        /// The SKU.
        /// </param>
        public static void MoveItemToBasket(this IWishList wishList, string sku)
        {
            var lineItem = wishList.Items.FirstOrDefault(x => x.Sku.Equals(sku));

            wishList.MoveItemToBasket(lineItem);
        }
Beispiel #18
0
 public WishListController(IWishList wishList)
 {
     _wishList = wishList ?? throw new ArgumentNullException(nameof(wishList));
 }
Beispiel #19
0
 /// <summary>
 /// Empties the wish list.
 /// </summary>
 /// <param name="merchelloContext">
 /// The merchello context.
 /// </param>
 /// <param name="wishlist">
 /// The wish list.
 /// </param>
 internal static void Empty(IMerchelloContext merchelloContext, IWishList wishlist)
 {
     wishlist.Items.Clear();
     Save(merchelloContext, wishlist);
 }
Beispiel #20
0
        /// <summary>
        /// Refreshes the runtime cache
        /// </summary>
        /// <param name="merchelloContext">The merchello context</param>
        /// <param name="wishlist">The <see cref="IWishList"/></param>
        public static void Refresh(IMerchelloContext merchelloContext, IWishList wishlist)
        {
            var cacheKey = MakeCacheKey(wishlist.Customer);
            merchelloContext.Cache.RuntimeCache.ClearCacheItem(cacheKey);

            var customerItemCache = merchelloContext.Services.ItemCacheService.GetItemCacheWithKey(wishlist.Customer, ItemCacheType.Wishlist);
            wishlist = new WishList(customerItemCache, wishlist.Customer);
            merchelloContext.Cache.RuntimeCache.GetCacheItem(cacheKey, () => wishlist);
        }
 /// <summary>
 /// Moves the wish list to the basket.
 /// </summary>
 /// <param name="wishList">
 /// The wish list.
 /// </param>
 /// <param name="lineItem">
 /// The line Item.
 /// </param>
 public static void MoveItemToBasket(this IWishList wishList, ILineItem lineItem)
 {
     wishList.MoveItemToBasket(lineItem.Key);
 }
Beispiel #22
0
        /// <summary>
        /// Saves the wish list.
        /// </summary>
        /// <param name="merchelloContext">
        /// The merchello context.
        /// </param>
        /// <param name="wishlist">
        /// The wish list.
        /// </param>
        internal static void Save(IMerchelloContext merchelloContext, IWishList wishlist)
        {
            // Update the wishlist item cache version so that it can be validated in the checkout
            ((WishList)wishlist).VersionKey = Guid.NewGuid();

            merchelloContext.Services.ItemCacheService.Save(((WishList)wishlist).ItemCache);

            Refresh(merchelloContext, wishlist);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="WishListOperationsController"/> class.
 /// </summary>
 public WishListOperationsController()
 {
     if (CurrentCustomer != null) _wishList = ((ICustomer)CurrentCustomer).WishList();
 }