private void popupSubjectButton_Click(object sender, System.Windows.Input.GestureEventArgs e) { popup_edit_delete popup = new popup_edit_delete(); popup.BtnDelete.Click += new RoutedEventHandler(deleteSubjectButton_Click); edit_delete_popup = new MessagePrompt(); edit_delete_popup.Title = "Studentus"; edit_delete_popup.Body = popup; edit_delete_popup.Show(); var su = sender as TextBlock; this.sub = (StudentusDB.Model.Subject)su.DataContext; }
//private void SemesterChanged(object sender, SelectionChangedEventArgs e) //{ // if (semesterPick.SelectedIndex != -1) // { // semesterPick.SelectedItem = App.ViewModel.CurrentSemester; // } //} private void newSubjectBarButton_Click(object sender, EventArgs e) { if (subjectName.Text == "") { MessageBox.Show("Please enter a name for your new subject."); return; } Subject subjectToAdd = new Subject { NazivPredmeta = subjectName.Text, OznakaSemestra = App.ViewModel.CurrentSemester.OznakaSemestra }; App.ViewModel.AddSubject(subjectToAdd); if (NavigationService.CanGoBack) { NavigationService.GoBack(); } }
public void DeleteSubjectItem(Subject subjectForDelete) { // Remove the to-do item from the "all" observable collection. AllSubjectItems.Remove(subjectForDelete); // Remove the to-do item from the data context. studentusDB.SubjectItems.DeleteOnSubmit(subjectForDelete); // Save changes to the database. studentusDB.SubmitChanges(); }
public void AddSubject(Subject newSubjectItem) { studentusDB.SubjectItems.InsertOnSubmit(newSubjectItem); AllSubjectItems.Add(newSubjectItem); studentusDB.SubmitChanges(); }