Another variant that you can apply is to work with ViewModels.
A ViewModel is a class whose properties would be exactly what you need to show in the specific view for which it is made, because in theory you can make a ViewModel for each view.
Another important detail is that in the case of the view Create
, for example you could use two ViewModels, one that would be the model that would use the view, and the other would be the one that would receive the action method Create
with the attribute [HttpPost]
, this in case it was convenient, but it can be enough with the same ViewModel for both methods of action.
In this way, your ViewModel for the view Create
, let's say you call ProveedorDtoViewModel
would have only the two properties you want ( RazonSocial
and Direccion
) and when you go to do the view, you select as Clase de modelo
to the ViewModel that you created for this view ( ProveedorDtoViewModel
).
Then, to pass the information of your Entity ( ProveedorDto
) to the corresponding ViewModel ( ProveedorDtoViewModel
) you can do it manually or using the tool Automapper .
I know that with this explanation you may not solve much, but at least it is an introduction and I hope it will be useful.
Greetings.