public void SalespersonControllerTest_GetAll()
 {
     Task.Run(async() =>
     {
         var people = await controller.GetAllAsync();
         Assert.AreNotEqual(0, people.ToList().Count);
     }).GetAwaiter().GetResult();
 }
示例#2
0
        private async Task LoadSalespeople()
        {
            obsPeople = new ObservableCollection <Salesperson>();
            try
            {
                var people = await controller.GetAllAsync();

                people.ToList().ForEach(x => obsPeople.Add(x));
                DataGrid.ItemsSource = obsPeople;
            }
            catch (ApiException ex)
            {
                MessageBox.Show(ex.Message, "API Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
示例#3
0
        private async Task <IEnumerable <Salesperson> > LoadPeople()
        {
            SalespersonController controller = new SalespersonController();
            var people = await controller.GetAllAsync();

            var converted = new List <Salesperson>();

            foreach (var person in people.ToList())
            {
                converted.Add(new Salesperson()
                {
                    Id       = person.Id,
                    Name     = person.Name,
                    LastName = person.LastName
                });
            }
            return(converted);
        }
        private async Task LoadSalespeople()
        {
            obsSalespeople = new ObservableCollection <Salesperson>();
            try
            {
                var sales = await salespersonContext.GetAllAsync();

                sales.ToList().ForEach(x => obsSalespeople.Add(x));

                PrimarySalespersonNewComboBox.ItemsSource      = obsSalespeople;
                ReassignPrimarySalespersonComboBox.ItemsSource = obsSalespeople;
                SecondarySalespersonComboBox.ItemsSource       = obsSalespeople;
            }
            catch (ApiException ex)
            {
                MessageBox.Show(ex.Message, "API Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }