Example #1
0
 public ActionResult <Product> AddItem(int basketNumber, int productNumber)
 {
     logger.LogInformation($"AddItem Post called ({productNumber})");
     try
     {
         return(Created(Request.Path, manager.AddItem(basketNumber, productNumber)));
     }
     catch (Exception e)
     {
         return(StatusCode(500, e.Message));
     }
 }
Example #2
0
        public JsonResult AddToCart(string partNo, int quantity)
        {
            var currentBasket = GetCurrentBasket();

            if (string.IsNullOrEmpty(currentBasket.ExternalId))
            {
                currentBasket = (BasketDto)_basketManager.CreateBasket(_sessionModel.CurrentUser);
                _sessionModel.CurrentBasketId = currentBasket.ExternalId;
            }

            currentBasket = (BasketDto)_basketManager.AddItem(_sessionModel.CurrentUser, currentBasket.ExternalId, partNo, quantity);

            return(Json(currentBasket));
        }