Beispiel #1
0
        /// <summary>
        /// Handles an add item operation exception.
        /// </summary>
        /// <param name="model">
        /// The <see cref="StoreAddItemModel"/>.
        /// </param>
        /// <param name="ex">
        /// The <see cref="Exception"/>.
        /// </param>
        /// <returns>
        /// The <see cref="ActionResult"/>.
        /// </returns>
        protected override ActionResult HandleAddItemException(StoreAddItemModel model, Exception ex)
        {
            if (Request.IsAjaxRequest())
            {
                // in case of Async call we need to construct the response
                var resp = new AddItemAsyncResponse {
                    Success = false, Messages = { ex.Message }
                };
                return(this.Json(resp));
            }

            return(base.HandleAddItemException(model, ex));
        }
Beispiel #2
0
        /// <summary>
        /// Handles the successful basket update.
        /// </summary>
        /// <param name="model">
        /// The <see cref="StoreBasketModel"/>.
        /// </param>
        /// <returns>
        /// The <see cref="ActionResult"/>.
        /// </returns>
        /// <remarks>
        /// Customization of the handling of an add item success
        /// </remarks>
        protected override ActionResult HandleAddItemSuccess(StoreAddItemModel model)
        {
            if (Request.IsAjaxRequest())
            {
                // Construct the response object to return
                var resp = new AddItemAsyncResponse
                {
                    Success   = true,
                    ItemCount = this.GetBasketItemCountForDisplay()
                };

                return(this.Json(resp));
            }

            return(base.HandleAddItemSuccess(model));
        }