// GET: Basket public ActionResult AddToBasket(int id) { Product findedProduct = _productServices.GetProductById(id); Customer loginCustomer = Session["loginCustomer"] as Customer; Basket basket = new Basket() { CustomerId = loginCustomer.CustomerId, ProductId = findedProduct.ProductId, CreatedDate = DateTime.Now, ModifiedDate = DateTime.Now, RemovedDate = DateTime.Now }; _basketServices.AddToBasket(basket); return(RedirectToAction("Index", "Home")); }
public ActionResult AddToBasket(int id) { Customer loginCustomer = Session["loginCustomer"] as Customer; Product product = _productServices.GetProductById(id); if (Session["loginCustomer"] != null) { Basket basket = new Basket() { CustomerId = loginCustomer.CustomerId, ProductId = product.ProductId, CreatedDate = DateTime.Now }; _basketServices.AddToBasket(basket); return(RedirectToAction("Index", "Product")); } return(RedirectToAction("Index", "Home")); }
public ActionResult AddToBasket(string Id) { basketServices.AddToBasket(this.HttpContext, Id); return(RedirectToAction("Index")); }