tags:

views:

408

answers:

1

I'm trying to understand the basic MVVM design approach, but I dont' understand where is the best tips for work with CRUD operations.

a. Create a ViewModel with abstract of properties and in this ViewModel implement CRUD methods?

b. Create ViewModels base and then add properties for ObservableCollections of Viewmodel?.

Can you said me , how you i can do this, please!.

+2  A: 

Hi Rangel

With MVVM, all business logic and interaction with a data source should occur in the model.
Your ViewModel will expose the data and functionality that the View requires.

So if for example you had a button on your view that removed an item from the database, the button would bind to an ICommand instance on the ViewModel. Once the ICommand executes, the implementation of this command will communicate with the model to make sure the item is deleted. The viewmodel is then populated with the new data to allow the view to update.

Ray Booysen
Thanks Ray, I'm new with MVVM.
Rangel
My pleasure! :)
Ray Booysen