We currently use DTO for Web API request and response
and use ViewModel to pass data to the View in MVC
Currently, we have:
- DTO as a separate project
- ViewModel is inside the UI project (another folder along with Controllers)
Only difference I see in our case is that DTO has to be passed over the wire and sent as JSON while ViewModel has to be passed inside the view to be render as HTML.
Should we mantain separate transfer objects for MVC applications and our App/other clients OR do both of these jobs through DTOs only i.e. passing DTO inside the View instead of ViewModel? What could be possible downside of it?
I read many responses here but there's no example and convincing reason to keep separate ViewModel and DTO in our case.