//Konstruktor for New public WindowReservation(WindowVerwaltung wf) { this.DataContext = this; InitializeComponent(); Title.Content = "New Reservation"; CurrentReservation = new Reservation(); CurrentReservation.EndDate = DateTime.Today; CurrentReservation.StartDate = DateTime.Today; cbRoom.ItemsSource = new ObservableCollection <TblRoom>(new entitiesDataContext().TblRoom); WF = wf; }
//Konstruktor for Edit public WindowReservation(WindowVerwaltung wf, Reservation res) { this.DataContext = this; InitializeComponent(); Title.Content = "Edit Reservation"; CurrentReservation = res; var ro = new entitiesDataContext().TblRoom.ToList(); cbRoom.ItemsSource = new ObservableCollection <TblRoom>(ro); cbRoom.SelectedItem = ro.Where <TblRoom>(r => r.RoomId == res.RoomFK).FirstOrDefault(); WF = wf; }