Example #1
0
        /// <summary>
        /// Add a purchase to the shopping cart.
        /// </summary>
        /// <param name="locationId"></param>
        /// <param name="organizationId"></param>
        /// <returns></returns>
        public ActionResult Add(int?locationId, int?organizationId)
        {
            var model = new Models.Purchase {
                Devices = GetDevices(locationId, organizationId)
            };

            return(PartialView(model));
        }
Example #2
0
        public ActionResult Add(int?locationId, int?organizationId, Models.Purchase model)
        {
            if (ModelState.IsValid)
            {
                // add purchase to cart and save in session
                if (Session["cart"] as List <Models.Purchase> == null)
                {
                    Session["cart"] = new List <Models.Purchase>();
                }

                ((List <Models.Purchase>)Session["cart"]).Add(model);

                return(new EmptyResult());
            }

            model.Devices = GetDevices(locationId, organizationId);

            Response.StatusCode             = 417;
            Response.TrySkipIisCustomErrors = true;

            return(PartialView(model));
        }