ol muser
asked on
best place to use a web service in MVC4
Hi, I have inherited a MVC4 application that was using a database to retrieve customer data, but now that information is available as a web service.
My confusion is should I access this web service in the ViewModel or should I go all the way to the Model?
pls note I'm new to MVC in ASP.net, not to mention MVC4.
thanks!
My confusion is should I access this web service in the ViewModel or should I go all the way to the Model?
pls note I'm new to MVC in ASP.net, not to mention MVC4.
thanks!
A viewmodel is used to only represent the data of your view (hence the name). It would not make sense to call this data from such classes. Since the web service is effectively your data store, I would say that the model would be the place to retrieve your data.
ASKER
But what if the information gathered from the web service is only relevant to the view? Say a picture that is used in the view but never stored back in the model or in the underlying database? thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.