Exemplo n.º 1
0
 public ActionResult GetEspecimeById([FromHeader] string ibge, [FromRoute] int id)
 {
     try
     {
         ibge = _config.GetConnectionString(Connection.GetConnection(ibge));
         Especime item = _repository.GetEspecimeById(ibge, id);
         return(Ok(item));
     }
     catch (Exception ex)
     {
         var response = TrataErro.GetResponse(ex.Message, true);
         return(StatusCode((int)HttpStatusCode.InternalServerError, response));
     }
 }
Exemplo n.º 2
0
 public ActionResult Editar([FromHeader] string ibge, [FromBody] Especime model, [FromRoute] int id)
 {
     try
     {
         ibge     = _config.GetConnectionString(Connection.GetConnection(ibge));
         model.id = id;
         _repository.Update(ibge, model);
         return(Ok(model));
     }
     catch (Exception ex)
     {
         var response = TrataErro.GetResponse(ex.Message, true);
         return(StatusCode((int)HttpStatusCode.InternalServerError, response));
     }
 }
Exemplo n.º 3
0
 public void Update(string ibge, Especime model)
 {
     try
     {
         Helpers.HelperConnection.ExecuteCommand(ibge, conn =>
                                                 conn.Execute(_command.Update, new
         {
             @especime      = model.especime,
             @tipo_especime = model.tipo_especime,
             @id            = model.id
         }));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }