public ActionResult AddProductToWishlist(string id) { _customerRepository.AddProductToWishList(Sanitizer.GetSafeHtmlFragment(id), _sessionContext.CurrentUser.UserId, true); var response = _customerRepository.GetWishlist(_sessionContext.CurrentUser.UserId.ToString(), true); return(JsonSuccess(response.Result, JsonRequestBehavior.AllowGet)); }
public ActionResult AddProductToWishlist(string id) { //WRONG IMPLEMENTATION: //TODO: CHange this - Vikram - 24Apr2017 if (_sessionContext.CurrentUser == null) { string errorMessage = "User Login required!"; return(JsonError(errorMessage, JsonRequestBehavior.DenyGet)); } var maximumWishlistItems = _sessionContext.CurrentSiteConfig.BasketSettings.MaximumWishlistItems; var customerId = _sessionContext.CurrentUser.UserId.ToString(); var key = string.Format(CacheKeys.WishList, customerId); var getWishlist = _customerRepository.GetWishlist(customerId, false); if (getWishlist != null && getWishlist.Result.Count < maximumWishlistItems) { var response = _customerRepository.AddProductToWishList(Sanitizer.GetSafeHtmlFragment(id), _sessionContext.CurrentUser.UserId, false); //Temporary Fix var result = _customerRepository.GetWishlist(customerId, false); System.Web.HttpContext.Current.Session[key] = result.Result; return(JsonSuccess(response.Result, JsonRequestBehavior.AllowGet)); } else { return(JsonSuccess(false, JsonRequestBehavior.AllowGet)); } }
public ActionResult BasketToWishlist(List <BasketAddModel> model) { var response = new ResponseModel <bool>(); foreach (var product in model) { response = _customerRepository.AddProductToWishList(Sanitizer.GetSafeHtmlFragment(product.ProductId.ToLower()), _sessionContext.CurrentUser.UserId, false); } return(JsonSuccess(response.Result, JsonRequestBehavior.AllowGet)); }
public ActionResult BasketToWishlist(List <BasketAddModel> model) { var response = new ResponseModel <bool>(); foreach (var product in model) { response = _customerRepository.AddProductToWishList(Sanitizer.GetSafeHtmlFragment(product.ProductId.ToLower()), _sessionContext.CurrentUser.UserId, false); } var customerId = _sessionContext.CurrentUser.UserId.ToString(); var key = string.Format(CacheKeys.WishList, customerId); var result = _customerRepository.GetWishlist(customerId, false); System.Web.HttpContext.Current.Session[key] = result.Result; return(JsonSuccess(response.Result, JsonRequestBehavior.AllowGet)); }