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()); }
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); } }
// GET: api/Products public IEnumerable <Product> GetAllProducts() { return(productsManager.GetAllProducts()); }
public IEnumerable <ProductDto> GetAllProducts() { _logger.LogInformation("Call GetAllProducts method"); return(_productsManager.GetAllProducts()); }