예제 #1
0
        public IActionResult Index()
        {
            List <Chamados> chamados = new ChamadosService(context: _context).GetAllChamados();

            ViewBag.Clientes = new ClienteService(context: _context).GetAllClients();
            return(View(chamados));
        }
예제 #2
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 }));
        }
예제 #3
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 }));
        }
예제 #4
0
 public ChamadosController(ChamadosService chamadosService)
 {
     _ChamadoService = chamadosService;
 }
예제 #5
0
 public ChamadosController()
 {
     appChamados = ConstrutorChamados.ChamadosBusiness();
 }