Beispiel #1
0
        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
            }));
        }
Beispiel #2
0
        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"));
        }
Beispiel #3
0
        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"));
        }
Beispiel #4
0
 public ActionResult Index(int page = 1)
 {
     ProductServiceRef.MainContractOf_ProductDataClient client = new ProductServiceRef.MainContractOf_ProductDataClient();
     return(View(client.GetPage(page)));
 }