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 AddEditProduct(int ProductId = 0) { var UserId = Session["AdminId"]; if (UserId != null) { productRepository = new ProductRepository(); collectionRepository = new CollectionRepository(); categoryRepository = new CategoryRepository(); //ViewBag.Categories = new SelectList(categoryRepository.getAllCategory(), "Id", "CategoryName"); var categoryList = categoryRepository.getAllCategory(); categoryList.Add(new Category_VM { Id = 0, CategoryName = "---SELECT---", }); categoryList = categoryList.OrderBy(x => x.Id).ToList(); ViewBag.Categories = new SelectList(categoryList, "Id", "CategoryName"); var collectionList = collectionRepository.GetAllCollections(); collectionList.Add(new Collection_VM { CollectionId = 0, CollectionName = "---SELECT---" }); collectionList = collectionList.OrderBy(x => x.CollectionId).ToList(); ViewBag.CollectionsList = new SelectList(collectionList, "CollectionId", "CollectionName"); //ViewBag.CollectionsList = new SelectList(collectionRepository.GetAllCollections(), "CollectionId", "CollectionName"); ViewBag.SubCategories = new SelectList(_DBContext.SubCategories.ToList(), "Id", "SubCategoryName"); ViewBag.ParentProductList = new SelectList(productRepository.GetParentProduct(ProductId), "ProductId", "Title"); if (ProductId > 0) { var product = productRepository.GetProductById(ProductId); return(View(product)); } return(View()); } return(RedirectToAction("Index", "Admin")); }
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")); } }
public ActionResult Index() { return(View(_CollectionRepository.GetAllCollections())); }