public IActionResult GetVeredaById(int idVereda) { try { fincaRepositor = new FincaRepositor(_config, Request); if (!fincaRepositor.ExistVereda(idVereda)) { throw new Exception("La vereda especificada no existe"); } return(Ok(new { statusCode = 200, message = "success", veredas = fincaRepositor.CargarVeredaById(idVereda) })); } catch (Exception ex) { return(new ResponseContext().getFauilureResponse(ex)); } }
public IActionResult UpdateVereda(int id, [FromBody] AgregarVereda vereda) { try { fincaRepositor = new FincaRepositor(_config, Request); if (!fincaRepositor.ExistVereda(id)) { throw new Exception("La vereda no existe."); } return(Ok(new { statusCode = 200, message = "success", vereda = fincaRepositor.ActualizarVereda(vereda, id) })); } catch (Exception ex) { return(new ResponseContext().getFauilureResponse(ex)); } }
public IActionResult DeleteVereda(int id) { try { fincaRepositor = new FincaRepositor(_config, Request); if (!fincaRepositor.ExistVereda(id)) { throw new Exception("La vereda especificada no existe"); } fincaRepositor.BorrarVereda(id); return(Ok(new { statusCode = 200, message = "success" })); } catch (Exception ex) { return(new ResponseContext().getFauilureResponse(ex)); } }