using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Shapes; namespace olimp8 { /// /// Interaction logic for CreateStaffWindow.xaml /// public partial class CreateStaffWindow : Window { olimp_8Entities entity = new olimp_8Entities(); public CreateStaffWindow() { InitializeComponent(); TeamsBox.ItemsSource = entity.StaffList.ToList(); } private void Button_Click(object sender, RoutedEventArgs e) { DateTime date = new DateTime(); date = Convert.ToDateTime(datePick.SelectedDate); Staff staff = new Staff { Date = date, StaffListID = Convert.ToInt32(TeamsBox.SelectedValue) }; entity.Staff.Add(staff); entity.SaveChanges(); MessageBox.Show("Смена создана!"); } } }