public ActionResult <IEnumerable <ProductModel> > Index()
        {
            //get the products
            List <ProductModel> productList = repository.AllProducts();
            //translate to DTO
            IEnumerable <ProductsDTO> productDTOList = from p in productList
                                                       select
                                                       new ProductsDTO(p.Id, p.Name, p.Price, p.Description);

            return(productList);
        }
Exemplo n.º 2
0
 public IActionResult Index()
 {
     return(View(repository.AllProducts()));
 }