public IActionResult AddMultipleToShoppingCart([FromServices] CartRelatedService service, int productid, int quantity, bool?buyNow) { var productselected = db.Products.FirstOrDefault(x => x.ProductId == productid); string customerid = Request.Cookies["customerId"]; string sessionid = Request.Cookies["sessionId"]; if (sessionid == null) { customerid = "0"; } if (productselected != null) { service.AddToCart(productselected, productid, quantity, customerid, sessionid); } if (buyNow == true) { return(RedirectToAction("Index", "Cart")); } else { return(RedirectToAction("ProductDetailPage", "Gallery", new { id = productid })); } }
public IActionResult AddSimilarToShoppingCart([FromServices] CartRelatedService service, int productid) { var productselected = db.Products.FirstOrDefault(x => x.ProductId == productid); string customerid = Request.Cookies["customerId"]; string sessionid = Request.Cookies["sessionId"]; if (sessionid == null) { customerid = "0"; } if (productselected != null) { service.AddToCart(productselected, productid, 1, customerid, sessionid); } return(RedirectToAction("ProductDetailPage", "Gallery", new { id = productid })); }
public IActionResult AddInDesign([FromServices] CartRelatedService service, int productid) { var productselected = db.Products.FirstOrDefault(x => x.ProductId == productid); string customerid = Request.Cookies["customerId"]; string sessionid = Request.Cookies["sessionId"]; if (sessionid == null) { customerid = "0"; } if (productselected != null) { service.AddToCart(productselected, productid, 1, customerid, sessionid); } return(RedirectToAction("DesignAndIllustration", "Gallery")); }