Created
December 16, 2015 00:16
-
-
Save BrianJVarley/0426cfb18f7c55d0ff3d 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 CustomerDetailsViewModel : IPageViewModel, IAsyncInitialization | |
{ | |
public CustomerDetailsViewModel(IDataService<CustomerModel> customerDataService, IDataService<Country> countryDataService, IDialogService dialogService) | |
{ | |
this._customerDataService = customerDataService; | |
this._countryDataService = countryDataService; | |
this._dialogService = dialogService; | |
Initialization = GetAllCustomersAsync(); | |
IsEnabled = true; | |
} | |
#region Properties | |
public CustomerModel SelectedCustomer { get; set; } | |
public ObservableCollection<CustomerModel> Customers { get; set; } | |
public ObservableCollection<Country> Countries { get; set; } | |
public Task Initialization { get; private set; } | |
private async Task GetAllCustomersAsync() | |
{ | |
var customerResult = await _customerDataService.GetAllAsync(); | |
Customers = customerResult.ToObservableCollection(); | |
var countryResult = await _countryDataService.GetAllAsync(); | |
Countries = countryResult.ToObservableCollection(); | |
} | |
#endregion | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment