/// <summary> /// Apply changes from form and attempt to save. Go to indicated View based on result of save /// </summary> protected ActionResult SaveObject(FormCollection form, string id, string viewNameForFailure, string viewNameForSuccess, object modelForSuccessViewIfDifferent = null) { object obj = NakedObjectsContext.GetObjectFromId(id); //Assuming id is for a transient, this will re-create a transient of same type if (SaveObject(form, ref obj)) { return(View(viewNameForSuccess, modelForSuccessViewIfDifferent ?? obj)); } return(View(viewNameForFailure, obj)); }