Beispiel #1
0
        public ActionResult DisplayProduct(string Pid)
        {
            ProductModelManager pmM = new ProductModelManager();
            ProductModel        pm  = pmM.GetProductByProductID(Pid);

            return(View(pm));
        }
Beispiel #2
0
        // GET: Cart
        public ActionResult DisplayCart()
        {
            List <ProductModel>      lstpm = new List <ProductModel>();
            ProductModelManager      ppM   = new ProductModelManager();
            Dictionary <string, int> dpm   = null;
            double Total = 0;

            if (Session["dpm"] != null)
            {
                dpm = Session["dpm"] as Dictionary <string, int>;
                foreach (KeyValuePair <string, int> item in dpm)
                {
                    ProductModel pm = ppM.GetProductByProductID(item.Key);
                    pm.RequiredQuantity = Convert.ToInt32(item.Value);
                    pm.Amount           = (pm.Rate) * Convert.ToDouble(pm.RequiredQuantity);
                    Total = Total + pm.Amount;
                    lstpm.Add(pm);
                }
                if (lstpm.Count > 0)
                {
                    lstpm[0].SubTotal = Total;
                }


                IEnumerable <ProductModel> ie = lstpm as IEnumerable <ProductModel>;
                Session["ie"] = ie;
                return(View(ie));
            }
            else
            {
                dpm = new Dictionary <string, int>();
                return(View("DisplayEmptyCart"));
            }
        }
        public ActionResult GetAllProducts()
        {
            ProductModelManager     manager  = new ProductModelManager();
            List <ProductViewModel> products = manager.GetAllProductRecords();

            return(this.View(products));
        }
Beispiel #4
0
        public ActionResult GetProduct(SearchKey sk, string Category, string Key)
        {
            ProductModelManager pmM   = new ProductModelManager();
            List <ProductModel> lstPm = new List <ProductModel>();

            if (!String.IsNullOrWhiteSpace(Key))
            {
                lstPm = pmM.GetProductByKeyword(Key, Category);
            }
            return(Json(lstPm, JsonRequestBehavior.AllowGet));
        }
        public ActionResult AddProductRecord(ProductAddViewModel productAddViewModel)
        {
            ProductModelManager manager = new ProductModelManager();
            var status = manager.AddProductRecord(productAddViewModel);

            this.ViewBag.Status = status;
            //productAddViewModel.Status = status;
            //return this.View(productAddViewModel);
            //return this.View(new ProductAddViewModel { Status = status });
            return(this.View());
        }
Beispiel #6
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            ProductModelManager pmM    = new ProductModelManager();
            List <string>       result = pmM.FetchCategory();

            Application["CategoriesFetched"] = result;
            HttpCookie cookie1 = null;
            Customer   C       = null;
            //HttpContext hp = new HttpContext();
            //if (HttpContext.Current.Cookies.Get("ActiveCustomer") != null)
            //{
            //     cookie1 = HttpContext.Request.Cookies.Get("ActiveCustomer");
            //     C = JsonConvert.DeserializeObject<Customer>(cookie1.Value);
            //}
        }
Beispiel #7
0
 public ProductModelController()
 {
     _Manager = new ProductModelManager();
 }