public JsonResult AddWishListsToCart(List <WishListInputModel> models) { try { Assert.ArgumentNotNull(models, "models"); var validationResult = new BaseJsonResult(); this.ValidateModel(validationResult); if (validationResult.HasErrors) { return(Json(validationResult, JsonRequestBehavior.AllowGet)); } var wishLists = new List <WishListHeader>(); //// TODO: ADD ALL THE ITEMS ON EACH WISH LIST TO THE CART var result = new WishListsBaseJsonResult(); result.Initialize(wishLists); return(Json(result, JsonRequestBehavior.AllowGet)); } catch (Exception e) { CommerceLog.Current.Error("AddWishListsToCart", this, e); return(Json(new BaseJsonResult("AddWishListsToCart", e), JsonRequestBehavior.AllowGet)); } }
public JsonResult AddToWishList(AddToWishListInputModel model) { try { Assert.ArgumentNotNull(model, "model"); var validationResult = new BaseJsonResult(); this.ValidateModel(validationResult); if (validationResult.HasErrors) { return(Json(validationResult, JsonRequestBehavior.AllowGet)); } var wishLists = new List <WishListHeader>(); var response = this.WishListManager.AddLinesToWishList(this.CurrentStorefront, this.CurrentVisitorContext, model); var result = new WishListsBaseJsonResult(response.ServiceProviderResult); if (response.ServiceProviderResult.Success && response.Result != null) { wishLists = this.WishListsHeaders(result); } result.Initialize(wishLists); return(Json(result, JsonRequestBehavior.AllowGet)); } catch (Exception e) { CommerceLog.Current.Error("AddToWishList", this, e); return(Json(new BaseJsonResult("AddToWishList", e), JsonRequestBehavior.AllowGet)); } }
public JsonResult ActiveWishLists(bool filter = false) { try { var wishLists = new List <WishListHeader>(); var userResponse = this.AccountManager.GetUser(Context.User.Name); var result = new WishListsBaseJsonResult(userResponse.ServiceProviderResult); if (userResponse.ServiceProviderResult.Success && userResponse.Result != null) { wishLists = filter ? this.WishListsHeaders(result).Take(5).ToList() : this.WishListsHeaders(result); } result.Initialize(wishLists); return(Json(result, JsonRequestBehavior.AllowGet)); } catch (Exception e) { CommerceLog.Current.Error("ActiveWishLists", this, e); return(Json(new BaseJsonResult("ActiveWishLists", e), JsonRequestBehavior.AllowGet)); } }