示例#1
0
        // GET: ProductSummary

        public ActionResult ProductSummary(SearchCascadingClass scc)
        {
            ProductDetail    pd = new ProductDetail();
            SearchController sc = new SearchController();

            sccObj = scc;
            ViewBag.CategoryList = new SelectList(sc.GetCategories(), "categoryID", "categoryName");
            pd.prodDet           = serv.getProdData(scc.SubCategoryID);
            pd.searchPanel       = serv.getSubCatAttData(scc.SubCategoryID);

            foreach (KeyValuePair <int, List <Dictionary <String, String> > > prod in pd.prodDet)
            {
                string imgPath = Server.MapPath("~" + "/App_Data/" + prod.Value[0]["ProductName"].Replace(" ", "") + ".jpg");

                byte[] byteData       = System.IO.File.ReadAllBytes(imgPath);
                string imreBase64Data = Convert.ToBase64String(byteData);
                string imgDataURL     = string.Format("data:image/jpg;base64,{0}", imreBase64Data);
                prod.Value[0]["ImagePath"] = imgDataURL;
            }
            TempData["ids"]      = new List <String>();
            ViewData["Products"] = pd;

            //set default avatar
            if (System.Web.HttpContext.Current.Session["UserAvatar"] == null)
            {
                Session["UserAvatar"] = "http://via.placeholder.com/150x150";
            }
            return(View());
        }
示例#2
0
 public ActionResult SearchPage(SearchCascadingClass scc)
 {
     return(this.RedirectToAction("ProductSummary", "ProductSummary", scc));
 }
示例#3
0
 public ActionResult searchBar(SearchCascadingClass scc)
 {
     sccObj = scc;
     System.Diagnostics.Debug.WriteLine("Posted SubCategory ID:" + sccObj.SubCategoryID + " CategoryID" + sccObj.CategoryId);
     return(this.RedirectToAction("ProductSummary", "ProductSummary", scc));
 }