private async void AddEmployeeButton_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrWhiteSpace(textBoxEmployeeName.Text))
            {
                MessageBox.Show("Name is required.");
                return;
            }

            var headers = await CreateAuthMetadataAsync();

            if (headers == null)
            {
                MessageBox.Show("Couldn't get accessToken.");
                return;
            }

            var r = await _client.AddEmployeeAsync(new Employee { Name = textBoxEmployeeName.Text }, headers);

            if (r.Succeed)
            {
                MessageBox.Show($"{textBoxEmployeeName.Text} was added.");
                textBoxEmployeeName.Text = "";
            }
            else
            {
                MessageBox.Show($"{textBoxEmployeeName.Text} was not added.");
            }
        }
Example #2
0
 public async Task Add(Employee employee)
 {
     await _client.AddEmployeeAsync(new AddEmployeeRequest()
     {
         Employee = employee
     });
 }