Link to home
Start Free TrialLog in
Avatar of ol muser
ol muserFlag for United States of America

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!
Avatar of kaufmed
kaufmed
Flag of United States of America image

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.
Avatar of ol muser

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
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial