private static void ActionCreateAccount() { Console.WriteLine("Er zijn momenteel " + mgr.ReadAllAccounts().Count() + "in de databank"); Console.Write("Account naam: "); string naam = Console.ReadLine(); Console.Write("Aantal rp"); int rp = Int32.Parse(Console.ReadLine()); Console.Write("Aantal ip"); int ip = Int32.Parse(Console.ReadLine()); Console.Write("Huidige rang: "); string rang = Console.ReadLine(); LoLAccount accountToAdd = new LoLAccount() { SummonerName = naam, AantalOfRp = rp, AantalOfIp = ip, HuidigeRang = rang }; mgr.AddLoLAccount(accountToAdd); Console.WriteLine("Er zijn momenteel " + mgr.ReadAllAccounts().Count() + "in de databank"); }
private static void ActionRemoveAccount() { Console.Write("Geef het id van het account dat je wil verwijderen: "); int input = Int32.Parse(Console.ReadLine()); LoLAccount accountToDelete = mgr.ReadAccount(input); mgr.DeleteAccount(accountToDelete); }
public void UpdateName(LoLAccount accountToUpdate) { using (ISession session = NHibernateHelper.OpenSession()) using (ITransaction transaction = session.BeginTransaction()) { session.Update(accountToUpdate); transaction.Commit(); } }
public void DeleteAccount(LoLAccount accountToRemove) { using (ISession session = NHibernateHelper.OpenSession()) using (ITransaction transaction = session.BeginTransaction()) { session.Delete(accountToRemove); transaction.Commit(); } }
public void AddLoLAccount(LoLAccount accountToAdd) { using (ISession session = NHibernateHelper.OpenSession()) using (ITransaction transaction = session.BeginTransaction()) { session.Save(accountToAdd); transaction.Commit(); } }
private static void ActionUpdateName() { Console.Write("Geef het id van het account dat je wil update: "); int input = Int32.Parse(Console.ReadLine()); LoLAccount accountToUpdate = mgr.ReadAccount(input); Console.Write("Nieuwe naam:"); string naam = Console.ReadLine(); accountToUpdate.SummonerName = naam; mgr.ChangeName(accountToUpdate); }
private static void ActionShowAccount() { Console.WriteLine("Account lijst: "); foreach (var acc in mgr.ReadAllAccounts()) { Console.WriteLine(acc.Id + ") " + acc.SummonerName); } Console.WriteLine("Geeft het id in: "); int input = Int32.Parse(Console.ReadLine()); LoLAccount account = mgr.ReadAccount(input); Console.WriteLine(account.Id + ": " + account.SummonerName + " - " + account.AantalOfIp + " - " + account.HuidigeRang); }
public void DeleteAccount(LoLAccount AccountToDelete) { repo.DeleteAccount(AccountToDelete); }
public void ChangeName(LoLAccount AccountToUpdate) { repo.UpdateName(AccountToUpdate); }
public void AddLoLAccount(LoLAccount AccountToAdd) { repo.AddLoLAccount(AccountToAdd); }