Пример #1
0
        public IActionResult Post(UsoCFDi usoCFDi)
        {
            UsoCFDiService usoCFDIService = new UsoCFDiService();

            try
            {
                usoCFDIService.InsertarUsoCFDi(usoCFDi);
                return(Ok());
            }
            catch (Exception e)
            {
                return(StatusCode(500, new { Message = "Error en el servidor" }));
            }
        }
Пример #2
0
        public IActionResult PutActivar(string id)
        {
            UsoCFDiService usoCFDIService = new UsoCFDiService();

            try
            {
                usoCFDIService.ActivarUsoCFDi(id);
                return(Ok());
            }
            catch (Exception e)
            {
                return(StatusCode(500, new { Message = "Error en el servidor" }));
            }
        }
Пример #3
0
        public IActionResult Get(string id)
        {
            UsoCFDiService usoCFDIService = new UsoCFDiService();
            var            res            = new Dictionary <string, Object>();

            try
            {
                res.Add("usoCFDi", usoCFDIService.ObtenerUsoCFDi(id));
                return(Ok(res));
            }
            catch (Exception e)
            {
                if (e is NotFoundException)
                {
                    return(NotFound(new { Message = e.Message }));
                }
                return(StatusCode(500, new { Message = "Error en el servidor" }));
            }
        }
Пример #4
0
        public IActionResult Get()
        {
            UsoCFDiService ser = new UsoCFDiService();
            var            res = new Dictionary <string, Object>();

            try
            {
                res = ser.getUsoCFDis();
                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));
            }
        }