コード例 #1
0
        public HomePageViewModel(INavigationService navigationService, IProductsManager productsManager) : base(navigationService)
        {
            PopularProducts     = productsManager.GetPopularProducts();
            BestSellingProducts = productsManager.GetBestSellingProducts();
            AllProducts         = productsManager.GetAllProducts();

            ProductSelectedCommand = new RelayCommand(parameter => { navigationService.Push(PageEnum.ProductDetailPage, parameter); });
            OpenFlyoutCommand      = new RelayCommand(() => navigationService.OpenFlyout());
        }
コード例 #2
0
        public void ValidateIds(List <int> ids)
        {
            if (!ids.Any())
            {
                throw new EmptyOrderException("OrderIsEmpty");
            }

            var goods    = _productsManager.GetAllProducts().Select(good => good.Id);
            var wrongIds = new List <int>();

            foreach (var id in ids)
            {
                if (!goods.Contains(id))
                {
                    wrongIds.Add(id);
                }
            }

            if (wrongIds.Any())
            {
                throw new ProductNotFoundException(wrongIds);
            }
        }
コード例 #3
0
 // GET: api/Products
 public IEnumerable <Product> GetAllProducts()
 {
     return(productsManager.GetAllProducts());
 }
コード例 #4
0
        public IEnumerable <ProductDto> GetAllProducts()
        {
            _logger.LogInformation("Call GetAllProducts method");

            return(_productsManager.GetAllProducts());
        }