How to update Model when binding to a ViewModel?
问题 I have an [HttpPost] action method signature like this: [HttpPost] public ActionResult Edit(ExistingPostViewModel model) { // Save the edited Post. } Now, in the past (when i didn't use ViewModels, e.g R&D), i had an implementation of an Edit method like this: [HttpPost] public ActionResult Edit(Post model) { var existingPost = repo.Find(model.Id); TryUpdateModel(existingPost); repo.Save(existingPost); return RedirectToAction("Success", existingPost.Id); } Which worked great. But i'm confused