コード例 #1
0
 public ActionResult <IEnumerable <Carro> > Get()
 {
     try
     {
         return(_carroService.Get().ToList());
     }
     catch (Exception ex)
     {
         return(StatusCode(500));
     }
 }
コード例 #2
0
        public ActionResult <Carro> Get([FromRoute] Guid key)
        {
            try
            {
                _logger.LogInformation("Received get request");

                return(Ok(_carroService.Get(key)));
            }
            catch (Exception exception)
            {
                _logger.LogError(exception, exception.Message);
                return(new StatusCodeResult(500));
            }
        }