I have an Asp.net MVC5 application structured like this:
- Domain project
- DAL project
- UI project (contains ViewModel at the moment, will probably put that into separate project as I expect that application will grow through time)
It works through Unit of work and a generic repository, injected with Unity.
My question is:
I'm strictly trying to use ViewModels for my UI Views, where should I put the logic to map Domain Model <=> ViewModel?
Should I do it in the Controller or perhaps put the mapping logic into the ViewModel itself and create methods ViewModel.FromDomainObject(DomainObject domainObject) or ViewModel.ToDomainObject(ViewModel viewModel) etc.?