Is there a difference between TryUpdate () and Update () methods in MVC 5?

Is there any difference between TryUpdate() and Update() methods in MVC 5? thanks in advance

+6
source share
2 answers

When using UpdateModel , if it has any problems when binding properties, it will throw an exception, saying that there was a binding error.

While TryUpdateModel does not TryUpdateModel an exception if there are any binding errors, instead, it logs an error in the model state dictionary, which you can check using the ModelState.IsValid property.

Well explained here - http://codetunnel.io/aspnet-mvc-tryupdatemodel-vs-updatemodel/

+2
source

Yogis are right. It also deserves consideration in this article which describes the Try-Parse template and why it is necessary.

0
source

All Articles