public IActionResult Index() { List <Chamados> chamados = new ChamadosService(context: _context).GetAllChamados(); ViewBag.Clientes = new ClienteService(context: _context).GetAllClients(); return(View(chamados)); }
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 })); }
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 })); }
public ChamadosController(ChamadosService chamadosService) { _ChamadoService = chamadosService; }
public ChamadosController() { appChamados = ConstrutorChamados.ChamadosBusiness(); }