public IActionResult PostVereda([FromBody] AgregarVereda agregarVereda) { try { fincaRepositor = new FincaRepositor(_config, Request); return(Ok(new { statusCode = 200, message = "success", vereda = fincaRepositor.AgregarVereda(agregarVereda) })); } catch (Exception ex) { return(new ResponseContext().getFauilureResponse(ex)); } }
public IActionResult GetPerPerson(int idPropietario) { try { fincaRepositor = new FincaRepositor(_config, Request); return(Ok(new { statusCode = 200, message = "success", finca = fincaRepositor.CargarPorPropietario(idPropietario) })); } catch (Exception ex) { return(new ResponseContext().getFauilureResponse(ex)); } }
public IActionResult GetVeredaByMunicipio(int id) { try { fincaRepositor = new FincaRepositor(_config, Request); return(Ok(new { statusCode = 200, message = "success", veredas = fincaRepositor.CargarVeredaByMunicipio(id) })); } catch (Exception ex) { return(new ResponseContext().getFauilureResponse(ex)); } }
public IActionResult Delete(int id) { try { fincaRepositor = new FincaRepositor(_config, Request); fincaRepositor.Borrar(id); return(Ok(new { statusCode = 200, message = "success" })); } catch (Exception ex) { return(new ResponseContext().getFauilureResponse(ex)); } }
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 Put(int id, [FromBody] Finca finca) { try { fincaRepositor = new FincaRepositor(_config, Request); if (id != finca.fin_id) { throw new Exception("La peticion no se realizo correctamente."); } return(Ok(new { statusCode = 200, message = "success", finca = fincaRepositor.Actualizar(finca) })); } 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)); } }