Beispiel #1
0
        public ActionResult Perfume_Details(int PerfumeID, int brandID = 0, String type = "", int currentPageIndex = 1)
        {
            String Message = "";
            var    perfume = db.Tbl_Perfume.Where(a => a.Perfume_ID == PerfumeID).SingleOrDefault();

            if (perfume != null)
            {
                Rep_Perfume rep_Perfume = new Rep_Perfume();
                var         seasons     = rep_Perfume.Get_PerfumeSeasons(PerfumeID);
                ViewBag.seasonCount = seasons.Count();

                PriceModel prices = new PriceModel();
                prices = InitDropdownLists(PerfumeID);
                ViewBag.cologne_price            = prices.ColognePrice;
                ViewBag.handySample_price        = prices.HandySamplePrice;
                ViewBag.companySample_price      = prices.CompanySamplePrice;
                ViewBag.cologne_weightList       = prices.CologneWeightList;
                ViewBag.handySample_weightList   = prices.HandySampleWeightList;
                ViewBag.companySample_weightList = prices.CompanySampleWeightList;

                string returnURl = "/Perfumes/" + brandID + "/" + type + "/" + currentPageIndex;
                ViewBag.returnURL = returnURl;

                return(View(perfume));
            }
            else
            {
                Message = "perfume with ID" + PerfumeID + "not found.";
                log.addLog(Message, "AddCart", "Cart", logStatus.EventLog);
                ViewBag.Error = "محصول پیدا نشد، لطفا دوباره تلاش کنید.";
                return(RedirectToAction("Index", "Home"));
            }
        }
Beispiel #2
0
        public JsonResult PerfumeModalDetails(int PerfumeID)
        {
            String Message = "";
            IEnumerable <Tbl_Season> pfs     = new List <Tbl_Season>();
            List <SelectListItem>    seasons = new List <SelectListItem>();
            PriceModel            prices     = new PriceModel();
            List <SelectListItem> images     = new List <SelectListItem>();

            var perfume = db.Tbl_Perfume.Where(a => a.Perfume_ID == PerfumeID).SingleOrDefault();

            if (perfume != null)
            {
                prices = InitDropdownLists(PerfumeID);

                Rep_Perfume rp         = new Rep_Perfume();
                var         seasonList = rp.Get_PerfumeSeasons(PerfumeID);
                foreach (var item in seasonList)
                {
                    seasons.Add(new SelectListItem {
                        Text = item.Season_Title, Value = item.Season_ImageIndex
                    });
                }

                Rep_PerfumeImages rep_images = new Rep_PerfumeImages();
                var imgs = rep_images.Get_PerfumeImages(PerfumeID);
                foreach (var item in imgs)
                {
                    images.Add(new SelectListItem {
                        Text = item.PerfumeImages_ImageIndex, Value = item.PerfumeImages_ID.ToString()
                    });
                }
            }
            else
            {
                Message = "perfume with ID" + PerfumeID + "not found.";
                log.addLog(Message, "AddCart", "Cart", logStatus.EventLog);
                ViewBag.Error = "محصول پیدا نشد، لطفا دوباره تلاش کنید.";
            }

            return(Json(
                       new
            {
                Perfume_Name = perfume.Perfume_Name,
                Perfume_Gender = perfume.Perfume_Gender,
                Brand_Title = perfume.Tbl_Brand.Brand_Title,
                Perfume_Country = perfume.Perfume_Country,
                Perfume_Description = perfume.Perfume_Description,
                Perfume_Notes = perfume.Perfume_Notes,
                Perfume_OlfactionGroups = perfume.Perfume_OlfactionGroups,
                Perfume_Perfumer = perfume.Perfume_Perfumer,
                Perfume_TemperOfPerfume = perfume.Perfume_TemperOfPerfume,
                PerfumeType_Title = perfume.Tbl_PerfumeType.PerfumeType_Title,
                seasons = new SelectList(seasons, "Value", "Text"),
                CategoryList = prices.CategoryList,
                ColognePrice = prices.ColognePrice,
                CologneWeightList = prices.CologneWeightList,
                CompanySamplePrice = prices.CompanySamplePrice,
                CompanySampleWeightList = prices.CompanySampleWeightList,
                HandySamplePrice = prices.HandySamplePrice,
                HandySampleWeightList = prices.HandySampleWeightList,
                Perfume_ImageIndex = perfume.Perfume_ImageIndex,
                images = new SelectList(images, "Value", "Text")
            },
                       JsonRequestBehavior.AllowGet));
        }