Beispiel #1
0
        public ProductListModel GetProductList()
        {
            var model    = new ProductListModel();
            var products = _dbContext.Products;

            foreach (var product in products)
            {
                model.Products.Add(new ProductListModel.ProductListItem()
                {
                    Id          = product.Id,
                    Name        = product.Name,
                    Description = product.Description
                });
            }

            return(model);
        }
Beispiel #2
0
        public IActionResult List()
        {
            ProductListModel model = _productService.GetProductList();

            return(Ok(model));
        }