Last active
December 22, 2015 14:20
-
-
Save BrianJVarley/592e3427036b0ce1488a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace MongoDBApp.ViewModels | |
{ | |
[ImplementPropertyChanged] | |
public class ProductsViewModel | |
{ | |
private IDataService<ProductModel> _productDataService; | |
public ProductsViewModel(IDataService<ProductModel> productDataService) | |
{ | |
this._productDataService = productDataService; | |
Initialization = GetAllProductsAsync(); | |
} | |
#region properties | |
public ObservableCollection<ProductModel> Products { get; set; } | |
public Task Initialization { get; private set; } | |
#endregion | |
#region methods | |
private async Task GetAllProductsAsync() | |
{ | |
var productsResult = await _productDataService.GetAllAsync(); | |
Products = productsResult.ToObservableCollection(); | |
} | |
#endregion | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment