public IActionResult AddItem(string productId, string customerName, int quantity) { if (productId == null) { return(NotFound()); } Product item = productService.Get(productId); if (item.TotalUnit >= quantity) { try { basketService.AddBasket(item, customerName, quantity); } catch (Exception err) { return(BadRequest(err.Message)); } } else { return(NotFound("There is no item in stock")); } return(Ok(productId)); }
public ActionResult AddToBasket(string id) { basketService.AddBasket(this.HttpContext, id); return(RedirectToAction("Index")); }
public ActionResult AddBasket(string Id) //Added the products = Id. { basketService.AddBasket(this.HttpContext, Id); return(RedirectToAction("Index")); }
public ActionResult <Basket> AddBasket(Basket Basket) { _service.AddBasket(Basket); return(Basket); }