private void buttonAdd_Click(object sender, EventArgs e) { LibraryEntities1 context = new LibraryEntities1(); Accaunt newAccaunt = new Accaunt() { Login = textBoxLogin.Text.Trim(), PasswordSHA1 =CalculateSHA1(textBoxLogin.Text).Trim(), FirstName = textBoxFName.Text.Trim(), LastName = textBoxLName.Text.Trim() }; context.Accaunts.AddObject(newAccaunt); context.SaveChanges(); MessageBox.Show("Добавянето е успешно."); Clear(); }
/// <summary> /// Create a new Accaunt object. /// </summary> /// <param name="accauntID">Initial value of the AccauntID property.</param> /// <param name="login">Initial value of the Login property.</param> /// <param name="passwordSHA1">Initial value of the PasswordSHA1 property.</param> /// <param name="firstName">Initial value of the FirstName property.</param> /// <param name="lastName">Initial value of the LastName property.</param> public static Accaunt CreateAccaunt(global::System.Int32 accauntID, global::System.String login, global::System.String passwordSHA1, global::System.String firstName, global::System.String lastName) { Accaunt accaunt = new Accaunt(); accaunt.AccauntID = accauntID; accaunt.Login = login; accaunt.PasswordSHA1 = passwordSHA1; accaunt.FirstName = firstName; accaunt.LastName = lastName; return accaunt; }
/// <summary> /// Deprecated Method for adding a new object to the Accaunts EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToAccaunts(Accaunt accaunt) { base.AddObject("Accaunts", accaunt); }