Exemplo n.º 1
0
        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" }));
            }
        }
Exemplo n.º 2
0
        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));
            }
        }
Exemplo n.º 3
0
        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));
            }
        }
Exemplo n.º 4
0
        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));
            }
        }
Exemplo n.º 5
0
        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));
            }
        }