Beispiel #1
0
        private async void FilterHasChangedAsync(SaleFilterHasChangedEventArgs obj)
        {
            //Since filter is used after any field got changed, we need to make sure
            //that we are not running more than one process at the time
            if (_isFilterWorking == false)
            {
                _isFilterWorking = true;
                var sales = await _carRepository.ApplySaleFilterAsync(SaleFiltersViewModel, obj.SaleFilter);

                Sales.Clear();
                TotalGrossSales = 0;
                TotalCars       = 0;
                foreach (var sale in sales)
                {
                    Sales.Add(new SaleListItemViewModel(sale, _eventAggregator));
                    TotalGrossSales += sale.SalePrice;
                    TotalCars++;
                }

                _isFilterWorking = false;
            }
        }