예제 #1
0
 private void AuthorProcessControl(string message)
 {
     try
     {
         bool result = _authorController.Add(currentAuthor);
         if (result)
         {
             message = "Yazar";
         }
         authorID = _authorController.GetAuthorbyName(currentAuthor);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
예제 #2
0
        private void AddAuthorBtn_Click(object sender, RoutedEventArgs e)
        {
            InitDataSource(ref authorItems, Mapper.AuthorsToAuthorViewModels, authorController.Get);

            AddAuthor addAuthor = new AddAuthor();

            if (addAuthor.ShowDialog().Value)
            {
                string name    = addAuthor.Name.Text;
                string surname = addAuthor.Surname.Text;

                if (name != null && surname != null)
                {
                    Author author = new Author(name, surname);
                    authorController.Add(author);
                    authorItems.Add(Mapper.AuthorToAuthorViewModel(author));
                    return;
                }
            }
        }