I created a generic repository for a EF4 context in MyProj.Domain.
Now I have services with methods like FindById, FindByUsername that use the repositories.
My controllers use these services.
Should I do the Mapping from Entities to View Models inside the services or in the controller?
The problem is for example, I might have UserEditViewModel and UserSignInViewModel.
In both cases I would need FindById.
So I might use UserService.FindById(id) in the controller and then map it to UserEditViewModel or UserSignInViewModel.
Or the other way around is to have two methods FindById in the service one returning UserEditViewModel and the other UserSignInViewModel.
I tend to do the mapping in the controller using AutoMapper so it is only a code line but I am not sure if this is the correct way.
View Complete Post