I have used Angular 8 as frontend and Asp.Net Core WebAPI as backend.
I have a model for rendering / binding / validating UI elements in Angular. I have a model for running CRUD operations with database using Entity Framework Core in WebAPI.
After I submit a UI form, I need to add some business logic on the captured fields and then add / update it to database.
My question is:
In which model format shall I pass the data to WebAPI? database model or do I need to create the same viewmodel in WebAPI as well and send the data as it is captured on UI and add business logic in WebAPI?
If I create viewmodel in WebAPI then there will be 2 identical models, one in Angular project, another in WebAPI and it will result in having 3 models for a single entity (2 viewmodels and 1 database model).
What could be the best approach in this case?