Beispiel #1
0
 public IActionResult Get(long id)
 {
     try
     {
         if (id <= 0)
         {
             return(StatusCode(400, new ErrorClass(400, "Codigo Invalido", DateTime.Now)));
         }
         var rota = _converter.Parser(Rota.FindById(id));
         if (rota == null)
         {
             return(StatusCode(404, new ErrorClass(404, "Sensor não encontrado", DateTime.Now)));
         }
         return(StatusCode(200, rota));
     }
     catch (MercurioCoreException ex)
     {
         return(StatusCode(400, new ErrorClass(400, ex.Message, DateTime.Now)));
     }
     catch (DBConnectionException ex)
     {
         return(StatusCode(500, new ErrorClass(400, ex.Message, DateTime.Now)));
     }
 }