예제 #1
0
        public JsonResult Fechar([FromBody] int chamadoId)
        {
            Chamados chamado = new ChamadosService(context: _context).GetSingleChamado(Id: chamadoId);

            chamado.Fechado            = true;
            chamado.DataHoraFechamento = DateTime.Now;

            Dictionary <string, string> retorno = new Dictionary <string, string>();

            retorno = new ChamadosService(context: _context).Edit(chamado: chamado);

            if (retorno.Count > 0)
            {
                return(Json(new { success = false, erro = retorno.FirstOrDefault().Key + " " + retorno.FirstOrDefault().Value }));
            }

            return(Json(new { success = true }));
        }
예제 #2
0
        public JsonResult Abrir([FromBody] int cliente)
        {
            Cliente  client  = new ClienteService(context: _context).GetSingleClient(Id: cliente);
            Chamados chamado = new Chamados();

            chamado.cliente          = client;
            chamado.DataHoraAbertura = DateTime.Now;
            chamado.Fechado          = false;

            Dictionary <string, string> retorno = new Dictionary <string, string>();

            retorno = new ChamadosService(context: _context).Create(chamado: chamado);

            if (retorno.Count > 0)
            {
                return(Json(new { success = false, erro = retorno.FirstOrDefault().Key + " " + retorno.FirstOrDefault().Value }));
            }

            return(Json(new { success = true }));
        }