I have a .NET MVC 4 project and just started Kendo UI MVVM framework. MVC uses ViewModels to send data from the controller to the view. I manage all my client side objects via the MVVM framework and use JSON to serialize them and send them back to my controller.
Currently I use the MVC ViewModel to return the data that will be static on my page and use jquery calls to fetch any dynamic data needed on my page. I find it confusing to have 2 methods to retrieve data. (And if I find it confusing, imagine the next developer that will have to work in my code)
I find it a bit useless to send the data to the View via ViewModels when I can easily have a structure where I query the controller (via Web API) on demand in my javascript code and save it into my MVVM view model directly.
I see a lot of advantages to using the MVVM framework in my UI, it makes control binding so much easier.
My question:
What is the best way to get the data from the controller to the MVVM ViewModel?
I feel that using the MVC ViewModel is duplicating work since I could query my Web API via ajax requests instead rather than translating my MVC ViewModel into my MVVM JS ViewModel.
Would it be a good approach to never return a MVC viewModel to my UI and always use client side Web API calls to retrieve all data?
Thanks,
Nicolas