Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.63 KB | None | 0 0
  1.  private void CreateNewDepartment()
  2.         {
  3.             if ((textBox1.Text != String.Empty) && (comboBox1.SelectedIndex >= 0))
  4.             {                
  5.                 db.AddToDepartment(Department.CreateDepartment(0, textBox1.Text, Convert.ToInt32(comboBox1.SelectedValue)));
  6.  
  7.                 Person person = (Person)comboBox1.SelectedItem;                
  8.                 Department dep = new Department();
  9.                 dep.departmentID = 0;
  10.                 dep.departmentName = textBox1.Text;                              
  11.                 person.Department.Add(dep);
  12.                 db.SaveChanges();
  13.             }
  14.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement