private void button1_Click(object sender, RoutedEventArgs e) { //Validate Group Name if (valid.ValidateTextField(txtGroupName.Text)) { //Add access group from entity model AccessGroup ag = new AccessGroup(); ag.Name = txtGroupName.Text; ag.Description = txtDescription.Text; model.AddToAccessGroups(ag); model.SaveChanges(); //Clear all Textboxs ClearTextBox(); LoadGrid(); } else { MessageBox.Show(" * Field Required"); } }
/// <summary> /// Create a new AccessGroup object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="description">Initial value of the Description property.</param> public static AccessGroup CreateAccessGroup(global::System.Int32 id, global::System.String name, global::System.String description) { AccessGroup accessGroup = new AccessGroup(); accessGroup.Id = id; accessGroup.Name = name; accessGroup.Description = description; return accessGroup; }
/// <summary> /// Deprecated Method for adding a new object to the AccessGroups EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToAccessGroups(AccessGroup accessGroup) { base.AddObject("AccessGroups", accessGroup); }