In controller, How to judge which it came from create action or update action?

Hi
In controller ,I want to judge operation where is come from create action or update action,
I just could judge operation where come from by entity’s null ID .
e.g
If entity’s ID is null,then it came from create action.
If entity’s ID is not null,then it came from update action.

Is there a better way?

thanks!

There is an ‘InitEntityEvent’ event in the edit screen controller.
This event is raised only when the screen is opened to create a New Entity.
You can reliably use it for the code you want to execute on the new entity.

You can also use EntityStates

if(entityStates.isNew(getEditedEntity())){
}