private List<WishListHeader> WishListsHeaders(WishListsBaseJsonResult result) { var response = this.WishListManager.GetWishLists(this.CurrentStorefront, this.CurrentVisitorContext); var wishLists = new List<WishListHeader>(); if (response.ServiceProviderResult.Success && response.Result != null) { wishLists = response.Result.ToList(); } result.SetErrors(response.ServiceProviderResult); return wishLists; }
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 UpdateWishList(UpdateWishListInputModel 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.UpdateWishList(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("UpdateWishList", this, e); return Json(new BaseJsonResult("UpdateWishList", 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); } }