コード例 #1
0
        public ActionResult Create()
        {
            ProductAddedViewModel model = new ProductAddedViewModel();

            model.CategoriesData = new SelectList(_categoryService.GetAll(), "CategoryId", "CategoryName");
            model.SuppliersData  = new SelectList(_supplierService.GetAll(), "SupplierId", "CompanyName");

            return(View(model));
        }
コード例 #2
0
        public ActionResult Update(int id)
        {
            Product product = _productService.GetById(id);
            ProductAddedViewModel modeladdedviewmodel = new ProductAddedViewModel();

            modeladdedviewmodel.CategoriesData = new SelectList(_categoryService.GetAll(), "CategoryId", "CategoryName");
            modeladdedviewmodel.SuppliersData  = new SelectList(_supplierService.GetAll(), "SupplierId", "CompanyName");
            modeladdedviewmodel.Product        = product;
            modeladdedviewmodel.CategoryId     = product.CategoryId;
            modeladdedviewmodel.SupplierId     = product.SupplierId;
            return(View(modeladdedviewmodel));
        }