Example #1
0
        public ActionResult About( int? id)
        {
            if (User.Identity.GetUserId() != null)
            {
                var productRepository = new ProductRepository();
                var pvm = new ProductViewModel();

                var gpab = productRepository.GetPeopleAlsoBought(id);

                pvm.PeopleAlsoBought = gpab;
                var idprod = productRepository.GetProductDetails(id);

                pvm.LargePhoto = idprod.LargePhoto;
                pvm.listPrice = idprod.listPrice;
                pvm.Name = idprod.Name;
                pvm.ProductId = idprod.ProductId;
                pvm.color = idprod.color;
                pvm.Weight = idprod.Weight;
                pvm.size = idprod.size;
                pvm.description = idprod.description;
                ViewBag.Message = "Your application description page.";

                return View(pvm);
            }
            else
            {
                return RedirectToAction("Login", "Account");
            }
        }
Example #2
0
        public ActionResult About(ProductViewModel pvm)
        {
            var productRepository = new ProductRepository();
            int productid = pvm.ProductId;
            int customerid = productRepository.GetCustomerID(User.Identity.GetUserId());
            int quantity = pvm.quantity;
            var idprod = productRepository.GetProductDetails(productid);
            pvm.LargePhoto = idprod.LargePhoto;
            pvm.listPrice = idprod.listPrice;
            pvm.Name = idprod.Name;
            pvm.color = idprod.color;
            pvm.Weight = idprod.Weight;
            pvm.size = idprod.size;
            pvm.description = idprod.description;
            var gpab = productRepository.GetPeopleAlsoBought(productid);

            pvm.PeopleAlsoBought = gpab;


            productRepository.InsertNewSaleItem(customerid, productid, quantity);

            TempData["alertmessage"] = "You have purchased   "+ pvm.Name + " of quantity " + pvm.quantity  ;

            //ScriptManager.RegisterStartupScript(this, GetType(), "alertMessage", "You have purchased" + pvm.quantity + " items of" + pvm.Name, true);
            return View(pvm);
        }