public UpdateImplementerForm(int id, IService <Implementer> implementerService)
 {
     IsModelValid = true;
     InitializeComponent();
     this.implementerService = implementerService;
     implementer             = implementerService.getById(id);
     IdTextBlock.Text        = implementer.Id.ToString();
     FirstNameTextBox.Text   = implementer.FirstName;
     LastNameTextBox.Text    = implementer.LastName;
     PatronymicTextBox.Text  = implementer.Patronymic;
 }
Пример #2
0
 private void SaveButton_Click(object sender, RoutedEventArgs e)
 {
     if (FirstNameTextBox.Text == "" || LastNameTextBox.Text == "" || PatronymicTextBox.Text == "")
     {
         IsModelValid = false;
     }
     if (IsModelValid)
     {
         Implementer implementer = new Implementer();
         implementer.FirstName  = FirstNameTextBox.Text;
         implementer.LastName   = LastNameTextBox.Text;
         implementer.Patronymic = PatronymicTextBox.Text;
         implementerService.Add(implementer);
         Close();
     }
     else
     {
         MessageBox.Show("All fields are required");
         IsModelValid = true;
     }
 }