Ejemplo n.º 1
0
        public ActionResult AddProduct()
        {
            if (Session["admin"] == null)
            {
                return(RedirectToAction("index", "Home"));
            }

            if (Session["product"] != null)
            {
                if (Session["ProductError"] != null)
                {
                    TempData["ProductError"] = Session["ProductError"];
                    Session["ProductError"]  = null;
                }
                TempData["product"]        = Session["product"];
                Session["product"]         = null;
                ViewData["MainCatagories"] = mainCategoryRepository.GetAll().ToList();
                return(View((Product)TempData["product"]));
            }
            else
            {
                if (Session["ProductError"] != null)
                {
                    TempData["ProductError"] = Session["ProductError"];
                    Session["ProductError"]  = null;
                }
                ViewData["MainCatagories"] = mainCategoryRepository.GetAll().ToList();
                return(View());
            }
        }
        public IHttpActionResult NavBar()
        {
            CategoryViewModel categoryViewModel = new CategoryViewModel();

            categoryViewModel.mainCategories     = mainCategoryRepository.GetAll();
            categoryViewModel.subCatetories      = subCategoryRepository.GetAll();
            categoryViewModel.finalSubCategories = finalSubCategoryRepository.GetAll();
            return(Ok(mainCategoryRepository.GetAll()));
        }
        public async Task <List <tblMainCategory> > GetMainCategories()
        {
            List <tblMainCategory> uList = new List <tblMainCategory>();

            uList = await mainCategoryRepository.GetAll();

            return(uList);
        }
        public IHttpActionResult Get()
        {
            //Session["admin"] = null;
            //Session["adminLoginID"] = null;
            //Session["adminUserName"] = null;
            //Session["paymentmethod"] = null;

            return(Ok(mainCategoryRepository.GetAll()));
        }
        public ActionResult AdminNavbar()
        {
            MainCategoryRepository     mainCategoryRepository     = new MainCategoryRepository();
            SubCategoryRepository      subCategoryRepository      = new SubCategoryRepository();
            FinalSubCategoryRepository finalSubCategoryRepository = new FinalSubCategoryRepository();
            CategoryViewModel          categoryViewModel          = new CategoryViewModel();

            categoryViewModel.mainCategories     = mainCategoryRepository.GetAll();
            categoryViewModel.subCatetories      = subCategoryRepository.GetAll();
            categoryViewModel.finalSubCategories = finalSubCategoryRepository.GetAll();
            return(PartialView("_AdminNavbar", categoryViewModel));
        }