public ActionResult RemoveWishList(string id)
        {
            _customerRepository.RemoveWishList(_sessionContext.CurrentUser.UserId.ToString(), Sanitizer.GetSafeHtmlFragment(id), true);
            var response = _customerRepository.GetWishlist(_sessionContext.CurrentUser.UserId.ToString(), true);

            return(JsonSuccess(response.Result, JsonRequestBehavior.AllowGet));
        }
Esempio n. 2
0
 public ActionResult WishlistToBasket(List <BasketAddModel> model)
 {
     foreach (var product in model)
     {
         var basket = _basketApi.AddToBasket(product);
         _customerRepository.RemoveWishList(Convert.ToString(_sessionContext.CurrentUser.UserId), product.ProductId, false);
         if (_sessionContext.CurrentUser != null)
         {
             var key = string.Format(CacheKeys.WishList, Convert.ToString(_sessionContext.CurrentUser.UserId));
             System.Web.HttpContext.Current.Session[key] = null;
         }
     }
     return(JsonSuccess(true, JsonRequestBehavior.AllowGet));
 }
 public ActionResult RemoveWishList(string id)
 {
     if (_sessionContext.CurrentUser != null && _sessionContext.CurrentUser.UserId != null && _sessionContext.CurrentUser.UserId != Guid.Empty)
     {
         var customerId = _sessionContext.CurrentUser.UserId.ToString();
         if (_sessionContext.CurrentUser != null)
         {
             var key = string.Format(CacheKeys.WishList, customerId);
             System.Web.HttpContext.Current.Session[key] = null;
         }
         var resp = _customerRepository.RemoveWishList(customerId, Sanitizer.GetSafeHtmlFragment(id), false);
     }
     return(RedirectToAction("Wishlist"));
 }
 public ActionResult RemoveWishList(string id, bool isSaveForLater = true)
 {
     if (_sessionContext.CurrentUser != null && _sessionContext.CurrentUser.UserId != null && _sessionContext.CurrentUser.UserId != Guid.Empty)
     {
         var customerId = _sessionContext.CurrentUser.UserId.ToString();
         var key        = string.Format(CacheKeys.WishList, customerId);
         if (System.Web.HttpContext.Current.Session[key] != null)
         {
             System.Web.HttpContext.Current.Session[key] = null;
         }
         _customerRepository.RemoveWishList(_sessionContext.CurrentUser.UserId.ToString(), Sanitizer.GetSafeHtmlFragment(id), isSaveForLater);
         var response = _customerRepository.GetWishlist(_sessionContext.CurrentUser.UserId.ToString(), isSaveForLater);
         return(JsonSuccess(response.Result, JsonRequestBehavior.AllowGet));
     }
     return(JsonSuccess(false, JsonRequestBehavior.AllowGet));
 }