Example #1
0
        public ActionResult UpdateBasket(BasketTableModel model)
        {
            if (!this.ModelState.IsValid)
            {
                return(this.CurrentUmbracoPage());
            }

            // The only thing that can be updated in this basket is the quantity
            foreach (var item in model.Items.Where(item => this.Basket.Items.First(x => x.Key == item.Key).Quantity != item.Quantity))
            {
                this.Basket.UpdateQuantity(item.Key, item.Quantity);
            }

            this.Basket.Save();

            return(this.CurrentUmbracoPage());
        }
Example #2
0
 /// <summary>
 /// The format total price.
 /// </summary>
 /// <param name="model">
 /// The model.
 /// </param>
 /// <returns>
 /// The <see cref="string"/>.
 /// </returns>
 public static string FormatTotalPrice(this BasketTableModel model)
 {
     return(FormatPrice(model.TotalPrice, model.Currency));
 }