public static void CreatPerson(string fio, string position, string pass) { try { ApplicationContext db = new ApplicationContext(); db.Incitalizations.Load(); foreach (var item in db.Incitalizations) { Inci.Add(item); } int intId = 0; for (int i = 0; i < Inci.Count; i++) { intId++; } Incitalization person = new Incitalization { Id = intId, Name = fio, Pass = pass, Pasition = position }; db.Incitalizations.Add(person); db.SaveChanges(); MessageBox.Show("Регистрация прошла успешна"); db.Dispose(); } catch (Exception excep) { MessageBox.Show(excep.Message); ExcepLog.Excep(excep); } }
/// <summary> /// загрузка данных из базы /// </summary> public void Download_Database() { db = new ApplicationContext(); db.Incitalizations.Load(); foreach (var item in db.Incitalizations) { Inci.Add(item); } }