private void newTeacherButton_Click(object sender, EventArgs e) { teacherName.Text = teacherName.Text.Trim(); if (teacherName.Text == "") { MessageBox.Show("Please enter a name for your new teacher."); return; } Teacher teacherToAdd = new Teacher { ImeNastavnika = teacherName.Text, PrezimeNastavnika = teacherSurname.Text, TitulaNastavnika = teacherTitle.Text, EmailNastavnika = teacherEmail.Text, TelefonNastavnika = teacherTel.Text, KonzultacijeNastavnika = teacherConsultation.Text }; App.ViewModel.AddTeacher(teacherToAdd); if (NavigationService.CanGoBack) { NavigationService.GoBack(); } }
private void popupTeachertButton_Click(object sender, System.Windows.Input.GestureEventArgs e) { popup_edit_delete popup = new popup_edit_delete(); popup.BtnDelete.Click += new RoutedEventHandler(deleteTeachertButton_Click); edit_delete_popup = new MessagePrompt(); edit_delete_popup.Title = "Studentus"; edit_delete_popup.Body = popup; edit_delete_popup.Show(); var tc = sender as TextBlock; this.tch = (StudentusDB.Model.Teacher)tc.DataContext; }
public void DeleteTeacherItem(Teacher teacherForDelete) { // Remove the to-do item from the "all" observable collection. AllTeacherItems.Remove(teacherForDelete); // Remove the to-do item from the data context. studentusDB.TeacherItems.DeleteOnSubmit(teacherForDelete); // Save changes to the database. studentusDB.SubmitChanges(); }
public void AddTeacher(Teacher newTeacherItem) { studentusDB.TeacherItems.InsertOnSubmit(newTeacherItem); AllTeacherItems.Add(newTeacherItem); studentusDB.SubmitChanges(); }