restore AccountVM

pull/1/head
Sascha Woitschetzki 2021-06-10 20:36:43 +07:00
parent 1251e28eef
commit 53ab189779
2 changed files with 29 additions and 1 deletions

@ -86,7 +86,7 @@ namespace Gremlin.GremlinUI
private void BtnRefreshAccountList_Click(object sender, RoutedEventArgs e)
{
ObservableCollection<Account> accounts = new(AcountVM.GetAccounts());
ObservableCollection<Account> accounts = new(AccountVM.GetAccounts());
dg_Test.ItemsSource = accounts;
}

@ -0,0 +1,28 @@
using Gremlin.GremlinData.DBClasses;
using Gremlin.GremlinData.EntityClasses;
using System;
using System.Collections.ObjectModel;
using System.Linq;
namespace Gremlin.GremlinUI.ViewModels
{
internal class AccountVM : BaseVM
{
public static ObservableCollection<Account> GetAccounts()
{
try
{
using (GremlinContext gremlinContext = new())
{
return new ObservableCollection<Account>(gremlinContext.Accounts.ToList());
}
}
catch (Exception ex)
{
ErrorHandler.ShowErrorInMessageBox(ex);
return null;
throw;
}
}
}
}