public IHttpActionResult Add(AddToBasketDTO model) { string variantSku = null; var product = CatalogLibrary.GetProduct(model.Sku); if (model.Variants == null || !model.Variants.Any()) { var variant = product.Variants.FirstOrDefault(); if (variant != null) { variantSku = variant.VariantSku; } } else { var variants = product.Variants.AsEnumerable(); foreach (var v in model.Variants) { variants = variants.Where(pv => pv.ProductProperties.Any(pp => pp.Value == v.Value)); } var variant = variants.FirstOrDefault(); if (variant != null) { variantSku = variant.VariantSku; } } TransactionLibrary.AddToBasket(model.Quantity, model.Sku, variantSku); return(Json(this.GetBasketModel())); }
public ActionResult Index(AddToBasketViewModel model) { string variant = GetVariantFromPostData(model.Sku, "variation-"); TransactionLibrary.AddToBasket(1, model.Sku, variant); return(RenderView(true)); }
public void btnAddToBasket_Click(object sender, EventArgs e) { var variant = GetVariantFromPostData(SiteContext.Current.CatalogContext.CurrentProduct, "variation-"); if (variant == null) { Response.Redirect(Request.RawUrl); } TransactionLibrary.AddToBasket(1, variant.Sku, variant.VariantSku); Response.Redirect(Request.RawUrl); }
public void AddToCart(String Sku) { TransactionLibrary.AddToBasket(1, Sku); }
public IHttpActionResult AddToBasket([FromBody] AddToBasketRequet request) { TransactionLibrary.AddToBasket(request.Quantity, request.Sku, request.VariantSku, addToExistingLine: true, executeBasketPipeline: true); return(Ok()); }
protected override object Run(AddToBasket request) { TransactionLibrary.AddToBasket(request.Quantity, request.Sku, request.VariantSku, addToExistingLine: true, executeBasketPipeline: true); return(new AddToBasketResponse()); }
protected void AddToBasketButton_OnClick(object sender, EventArgs e) { string sku = HiddenSku.Value; string variantSku = Request.Form["VariantSku"]; OrderLine orderline = TransactionLibrary.AddToBasket(1, sku, variantSku); }
public AddToBasketResponse Post(AddToBasket request) { TransactionLibrary.AddToBasket(request.Quantity, request.Sku, request.VariantSku, addToExistingLine: true, executeBasketPipeline: true); return(new AddToBasketResponse()); }