public ActionResult Edit() { ProductMaintenanceViewModel vm = new ProductMaintenanceViewModel(); vm.HandleRequest(); return(View(vm)); }
public ActionResult Edit(ProductMaintenanceViewModel vm) { if (!ModelState.IsValid && vm.EventCommand == "save") { vm.IsValid = false; vm.SetModeAfterValidation(); } else { vm.HandleRequest(); // NOTE: Must clear the model state in order to bind // the @Html helpers to the new model values ModelState.Clear(); } return(View(vm)); }