Agat
Agat

Reputation: 4779

MVVM pattern with ASP.NET MVC: which tasks it must be responsible for?

There is a number of posts about MVVM generally and also in relationship with MVC pattern, like this.

But they mostly describe just general concept of what should MVVM do (like, "remove most of the logic from ViewModel to Controller" etc).

I would like though to know more specifically which tasks in the app logic would rather be better to move to ViewModel than to have them in Controller?

(As even though that's great to have all the business logic in Controller, there are still some tasks which are more "client side" (or, at least, "presentation-") related, but still must be done on server side (with C#, for instance), like Data Formatting, Localization etc.)

(The talk is only about ASP.NET MVC (i.e., Web) extending with ViewModels using).

What's else?

Thank you.

Upvotes: 0

Views: 2618

Answers (1)

Pranav
Pranav

Reputation: 146

I am not a MVC developer(but MVVM developer) but I think I may know what you asking.

1. The main benefit of MVVM is Binding.(i.e. you want to change label simultaneously when you entering text in TextBox then you can easily do it using Binding)

2. To perform client side operations use MVVM. MVC is used to perform server side operations.

3. MVVM is used to update UI whiout sending request to server which is quite useful in many scenarios.

So keep these points in mind and move your code accordingly.

May be I missed out some points but as a MVVM developer I inform you as much as I can.

Upvotes: 2

Related Questions