예제 #1
0
        private void ApplyFilter(ApplyFilterModel model)
        {
            var products = _productService.GetAll(e => e.Price >= model.MinValue && e.Price <= model.MaxValue);

            Products = new ObservableCollection <Product>(products);

            CheckProductsAvailability();
        }
예제 #2
0
        private void NavigateTo(string url)
        {
            var param = new NavigationParameters
            {
                { Constants.Username, Username }
            };

            switch (url)
            {
            case Constants.CartNavigation:
                _regionManager.RequestNavigate(RegionNames.ContentRegion.ToString(), nameof(UserCartView), param);
                break;

            case Constants.HomeMenuItem:
                _regionManager.RequestNavigate(RegionNames.ContentRegion.ToString(), nameof(CatalogView), param);
                break;

            case Constants.FilterMenuItem:
                _dialogService.ShowDialog(nameof(FilterDialogView), null, result =>
                {
                    if (result.Result == ButtonResult.OK)
                    {
                        var payload = new ApplyFilterModel()
                        {
                            MinValue = result.Parameters.GetValue <double>(Constants.FilterMinValue),
                            MaxValue = result.Parameters.GetValue <double>(Constants.FilterMaxnValue)
                        };
                        _eventAggregator.GetEvent <ApplyFilterEvent>().Publish(payload);
                    }
                });
                break;

            case Constants.LogoutMenuItem:
                _regionManager.RequestNavigate(RegionNames.WindowRegion.ToString(), nameof(LoginView));
                break;
            }
        }