Exemplo n.º 1
0
        public IActionResult Shop()
        {
            ViewBag.Title = "Shop";
            var results = /*from p in _context*/ _repository /*.Products*/.GetAllProducts();

            //orderby p.Category
            //select p;

            return(View(results.ToList()));
        }
 public ActionResult <IEnumerable <Product> > Get()
 {
     try
     {
         return(Ok(_repository.GetAllProducts()));
     }
     catch (Exception ex)
     {
         _logger.LogError($"Failed to get products: {ex}");
         return(BadRequest("Failed to get products"));
     }
 }