public ActionResult AddEditCollection(int CollectionId)
        {
            var UserId = Session["AdminId"];

            if (UserId != null)
            {
                collectionRepository = new CollectionRepository();
                categoryRepository   = new CategoryRepository();
                bannersRepository    = new BannersRepository();

                List <Side> SideList = new List <Side>();
                Side        side     = new Side();
                side.sId   = 1;
                side.sName = "Right";
                SideList.Add(side);
                side       = new Side();
                side.sId   = 2;
                side.sName = "Left";
                SideList.Add(side);

                ViewBag.SideList        = new SelectList(SideList, "sId", "sName");
                ViewBag.Banners         = new SelectList(bannersRepository.GetBanners(), "Id", "BannerKeyName");
                ViewBag.Categories      = new SelectList(categoryRepository.getAllCategory(), "Id", "CategoryName");
                ViewBag.CollectionsList = new SelectList(collectionRepository.GetAllCollections(), "CollectionId", "CollectionName");
                ViewBag.SubCategories   = new SelectList(_DBContext.SubCategories.ToList(), "Id", "SubCategoryName");

                if (CollectionId > 0)
                {
                    var collection = collectionRepository.GetCollectionsById(CollectionId);
                    return(View(collection));
                }
                return(View());
            }
            return(RedirectToAction("Index", "Admin"));
        }
        public ActionResult Collection(int id)
        {
            _CollectionRepository = new CollectionRepository();
            var data = _CollectionRepository.GetCollectionsById(id);

            if (data != null)
            {
                return(View(data));
            }
            return(Index());
        }
Ejemplo n.º 3
0
        public ActionResult Index(int Id, string Menu, string Price, string Collection, string SubCat)
        {
            if (Id > 0 && !string.IsNullOrEmpty(Menu))
            {
                collectionRepository = new CollectionRepository();
                productRepository    = new ProductRepository();

                if (Menu == MenuName.Collection.ToString())
                {
                    ViewBag.ProductList = productRepository.GetProductsByCollection(Id, Price);
                    var result = collectionRepository.GetCollectionsById(Id);
                    return(View(result));
                }
                else if (Menu == MenuName.Jewellery.ToString())
                {
                    ViewBag.CollectionsList = new SelectList(collectionRepository.GetAllCollections(), "CollectionId", "CollectionName");
                    ViewBag.SubCategories   = new SelectList(_DBContext.SubCategories.ToList(), "Id", "SubCategoryName");

                    ViewBag.ProductList = productRepository.GetProductsByCategory(Id, Price, Collection, SubCat);
                    var result = (from j in _DBContext.Categories
                                  where j.Id == Id
                                  select new Collection_VM
                    {
                        CollectionName = j.Type.ToLower() == GenderType.men.ToString() ? j.CategoryName + " " + GenderType.men.ToString().ToUpper() : j.CategoryName + " " + GenderType.women.ToString().ToUpper(),
                        ImgName = j.ImagePath
                    }).FirstOrDefault();
                    return(View(result));
                }



                return(View());
            }
            else
            {
                return(RedirectToAction("Index", "Home"));
            }
        }