Exemplo n.º 1
0
 public ActionResult <Empresa> Delete(int id)
 {
     try
     {
         return(Ok(_service.Delete(id)));
     }
     catch (NotFoundException)
     {
         return(NotFound("Empresa não encontrada!"));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
 public IHttpActionResult Delete(int id)
 {
     try
     {
         return(Ok(empresasService.Delete(id)));
     }
     catch (EmpresaNaoEncontradaException)
     {
         return(NotFound());
     }
     catch
     {
         return(Content(HttpStatusCode.InternalServerError, "Ocorreu um erro desconhecido. Por favor, entre em contato com o suporte."));
     }
 }