// GET: ProductInWorks/Create public ActionResult Create() { var vm = new ProductInWorkCreateEditViewModel() { ProductsMultiSelectList = new MultiSelectList(_warehouseUow.Products.All, "ProductId", "Name"), WorksMultiSelectList = new MultiSelectList(_warehouseUow.WorkTypes.All, "WorkTypeId", "Description") }; vm.ProductsMultiSelectList = new SelectList(_warehouseUow.Products.All, "ProductId", "Description"); vm.WorksMultiSelectList = new SelectList(_warehouseUow.WorkTypes.All, "WorkTypeId", "Description"); return(View(vm)); }
public ActionResult Create(ProductInWorkCreateEditViewModel vm) { if (ModelState.IsValid) { _warehouseUow.ProductInWorks.Add(vm.ProductInWork); _warehouseUow.Commit(); return(RedirectToAction("Index")); } //vm.ProductsMultiSelectList = new MultiSelectList(_warehouseUow.Products.All, "ProductId", "Description", vm.ProductInWork.ProductId); //vm.WorksMultiSelectList= new MultiSelectList(_warehouseUow.WorkTypes.All, "WorkTypeId", "Description", vm.ProductInWork.WorkTypeId); return(View(vm.ProductInWork)); }