Exemplo n.º 1
0
        public IActionResult Shop()
        {
            var results = _repository.GetAllProducts();

            return(View(results));
        }
Exemplo n.º 2
0
 public IActionResult Get()
 {
     try
     {
         return(Ok(_mapper.Map <IEnumerable <Product>, IEnumerable <ProductViewModel> >(_repository.GetAllProducts())));
     }
     catch (Exception ex)
     {
         _logger.LogInformation($"Failed to get products: {ex}");
         return(BadRequest("Failed to get a products"));
     }
 }