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