private void btCreate_Click( object sender, RoutedEventArgs e )
 {
     using (var context = new Db1Entities())
     {
         var faction = new Factions
         {
             Name = TbName.Text,
             HomePlanet = TbHomeplanet.Text,
             Race = CbRace.SelectedValue.ToString(),
             Cunning = IudCunning.Value,
             Force = IudForce.Value,
             Wealth = IudWealth.Value,
             Income = IudIncome.Value,
             MaxHp = IudMaxHp.Value
         };
         context.Factions.Add(faction);
         context.SaveChanges();
     }
     MessageBox.Show("The Faction '" + TbName.Text + "' has been saved to the Database");
     btClear_Click(this, null);
 }
 private void LoadboxSelectionChanged( object sender, RoutedEventArgs e )
 {
     if (_loadBox.SelectedItem == null)
     {
         return;
     }
     _loadedFaction = (Factions) _loadBox.SelectedItem;
     _loadWindow.Close();
     LoadFaction();
 }