public IActionResult PutActivar(int id) { var res = new Dictionary <string, Object>(); try { var rsServ = new RazonSocialService(); rsServ.ActivarRazonSocial(id); return(Ok()); } catch (Exception e) { return(StatusCode(500, new { Message = "Error en el servidor" })); } }
public IActionResult Delete(int id) { var res = new Dictionary <string, Object>(); try { var rsServ = new RazonSocialService(); rsServ.deleteRazonSocial(id); return(Ok()); } catch (Exception e) { res.Add("Message", "Error en el servidor"); return(StatusCode(500, res)); } }
public IActionResult Post(RazonSocial razonSocial) { var res = new Dictionary <string, Object>(); try { var rsServ = new RazonSocialService(); rsServ.insertRazonSocial(razonSocial); res.Add("razonSocial", razonSocial); return(Ok(res)); } catch { res.Add("message", "Error en el servidor"); return(StatusCode(500, res)); } }
public IActionResult Put(int id, [FromBody] RazonSocial rs) { rs.idRazonSocial = id; var res = new Dictionary <string, Object>(); try { var rsServ = new RazonSocialService(); rsServ.updateRazonSocial(rs); return(Ok()); } catch (Exception e) { res.Add("message", "Error en el servidor"); return(StatusCode(500, res)); } }
public IActionResult Get(int id) { var res = new Dictionary <string, Object>(); try { var rsServ = new RazonSocialService(); res.Add("razonSocial", rsServ.getRazonSocial(id)); return(Ok(res)); } catch (Exception e) { if (e is NotFoundException) { res.Add("message", e.Message); return(NotFound(res)); } res.Add("message", "Error en el servidor"); return(StatusCode(500, res)); } }