public ActionResult Index(int ProductID) { ProductServiceRef.MainContractOf_ProductDataClient client = new ProductServiceRef.MainContractOf_ProductDataClient(); ProductData product = client.Get(ProductID); client.Close(); return(View(new ProductDetailViewModel { Product = product })); }
public RedirectToRouteResult RemoveFromCart(int ProductID) { ProductServiceRef.MainContractOf_ProductDataClient client = new ProductServiceRef.MainContractOf_ProductDataClient(); ProductData Productincart = client.Get(ProductID); if (Productincart != null) { GetCart().Deleting(Productincart); } client.Close(); return(RedirectToAction("Index")); }
public RedirectToRouteResult AddToCart(int ProductID) { ProductServiceRef.MainContractOf_ProductDataClient client = new ProductServiceRef.MainContractOf_ProductDataClient(); ProductData product = client.Get(ProductID); if (product != null) { try { GetCart().Adding(product, 1); } catch { return(RedirectToAction("Index")); } } client.Close(); return(RedirectToAction("Index")); }
public ActionResult Index(int page = 1) { ProductServiceRef.MainContractOf_ProductDataClient client = new ProductServiceRef.MainContractOf_ProductDataClient(); return(View(client.GetPage(page))); }