Exemplo n.º 1
0
 public ActionResult <IEnumerable <Product> > Get()
 {
     try
     {
         return(Ok(_repository.GetAllProducts()));
     }
     catch (Exception ex)
     {
         _logger.LogError($"Failed to return products: {ex}");
         return(BadRequest("Failed to return products"));
     }
 }
Exemplo n.º 2
0
        public IActionResult Shop()
        {
            var results = _repository.GetAllProducts();

            return(View(results));
        }