public ActionResult Edit(int Id) { ProductManager ProdManager = new ProductManager(); //CatalogManager catManager = new CatalogManager(); var Prod = ProdManager.GetProduct(Id); //var _Catalogs = catManager.GetCatalogs(); var Model = new Models.ProductModels.ProductEdit { Description = Prod.Description, Code = Prod.Code, Id = Prod.Id //Catalogs = new SelectList(_Catalogs, "Id", "Description"), //IdCatalog = Prod.CatalogProduct.Select(s=> s.IdCatalog).ToArray() }; return(View(Model)); }
public ActionResult Update(Models.ProductModels.ProductEdit model) { ProductManager ProdManager = new ProductManager(); //List<CatalogProduct> cList = new List<CatalogProduct>(); //foreach (var item in model.IdCatalog) //{ // cList.Add(new CatalogProduct { IdCatalog = item }); //} Product NewProduct = new Product { //CatalogProduct = cList, Code = model.Code, Description = model.Description, Id = model.Id }; ProdManager.UpdateProduct(NewProduct); return(RedirectToAction("Index")); }