示例#1
0
        // GET: Category
        public ActionResult AllCategories()
        {
            ViewBag.Message = "All Categories";

            CategoriesViewModel viewModel = new CategoriesViewModel();//gives me acces to this class

            viewModel.AllCategories = mapper.Map(categoriesDAL.GetAllCategories());
            return(View(viewModel));
        }
        public ActionResult CreateProduct()
        {
            ProductsViewModel viewModel = new ProductsViewModel();

            viewModel.AllSuppliers  = mapper.Map(SuppliersDAL.GetSuppliers());
            viewModel.AllBrands     = mapper.Map(BrandsDAL.GetBrands());
            viewModel.AllCategories = mapper.Map(CategoriesDAL.GetAllCategories());
            switch ((int)Session["RoleID"])
            {
            case 3:
                return(View(viewModel));

            case 4:
                return(View(viewModel));

            default:
                return(RedirectToAction("Index", "Home"));
            }
        }