예제 #1
0
        private async void GoToAddAuthor_Click(object sender, RoutedEventArgs e)
        {
            if (LoginBox.Text.Length > 0)
            {
                if (await CheckAccountExistsAsync(LoginBox.Text))
                {
                    if (!await CheckAuthorExistsAsync(LoginBox.Text))
                    {
                        var account = await authCore.GetAccountByLoginAsync(LoginBox.Text);

                        AddEditAuthor newAddAuthorWindow = new AddEditAuthor(null, account);
                        newAddAuthorWindow.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show("This account is already an author");
                    }
                }
                else
                {
                    MessageBox.Show("Account doesn't exist");
                }
            }
            else
            {
                MessageBox.Show("Login empty");
            }
        }
예제 #2
0
        private async void GoToEditAuthor_Click(object sender, RoutedEventArgs e)
        {
            if (AuthorBox.Text.Length > 0)
            {
                if (await CheckAuthorExistsAsync(AuthorBox.Text))
                {
                    var account = await authCore.GetAccountByLoginAsync(AuthorBox.Text);

                    var author = await authorCore.GetAuthorByAccountIdAsync(account.AccountId);

                    AddEditAuthor newAddAuthorWindow = new AddEditAuthor(author, account);
                    newAddAuthorWindow.ShowDialog();
                }
                else
                {
                    MessageBox.Show("Author doesn't exist");
                }
            }
            else
            {
                MessageBox.Show("Login empty");
            }
        }