I have an MVC layer with controllers that use the Service layer to get and store data. In my service layer I have methods like this:
public interface ISetServices
{
List<Set> GetBreadcrumbs(int? parentSetId);
List<Set> GetAllSets();
List<Set> GetAllTopLevelArchivedSets();
List<Set> GetTopLevelSets();
Set GetSet(int? setId);
Set CreateSet(string name, string details, int? parentSetId);
void DeleteSet(int? setId);
void ArchiveSet(int? setId);
void UnArchiveSet(int? setId);
/ etc
My MVC layer uses viewModels to display data. This has been fine up until implementing the Edit services - What I'm trying to do now is create an UpdateSet method that takes a viewModel from the controller and updates the database accordingly.
Since the MVC layer is dependent on the Service layer, the service layer has no knowledge of viewModels. Is this where dependency injection comes in? Or is there a better way to approach this that I'm overlooking?
Set
a view model or a DTO/Domain Model? – Martin