public static Pergunta GetAtivaByCodigoImportacao(string codigoImportacao, Connection conn, SQLiteTransaction transaction) { using (var dao = new PerguntaDAO(conn)) { return(dao.GetAtivaByCodigoImportacao(codigoImportacao, transaction)); } }
public ActionResult EditarResposta(int idPergunta, int idResposta) { ViewBag.DescPergunta = PerguntaDAO.buscarPerguntaID(idPergunta).des_Pergunta; ViewBag.idPergunta = idPergunta; ViewBag.idResposta = idResposta; return(View()); }
public static bool ExistsByCodigoImportacao(string codigoImportacao, int id, Connection conn, SQLiteTransaction transaction) { using (var dao = new PerguntaDAO(conn)) { return(dao.ExistsByCodigoImportacao(codigoImportacao, id, transaction)); } }
public bool SetById(int id, Connection conn, SQLiteTransaction transaction) { using (var dao = new PerguntaDAO(conn)) { return(dao.SetById(this, id, transaction)); } }
public static List <Pergunta> GetAllAtivas(Connection conn, SQLiteTransaction transaction) { using (var dao = new PerguntaDAO(conn)) { return(dao.GetAllAtivas(transaction)); } }
public ActionResult Respostas(string id) { var dao = new PerguntaDAO(); dao.SomarAcesso(int.Parse(id)); ViewBag.Pergunta = dao.BuscaPorId(int.Parse(id)); if (ViewBag.Pergunta.CodUsuario != null) { var perguntador = new UsuarioDAO(); ViewBag.UsuarioPerguntador = perguntador.BuscaPorId((int)ViewBag.Pergunta.CodUsuario); } var daoRespostas = new RespostaDAO(); ViewBag.ListaRespostas = daoRespostas.BuscaPorPergunta(ViewBag.Pergunta.Id); IList <Usuario> user = new List <Usuario>(); foreach (var resposta in ViewBag.ListaRespostas) { var respondedor = new UsuarioDAO(); user.Add((Usuario)respondedor.BuscaPorId(resposta.CodUsuario)); } ViewBag.ListaRespondedor = user; return(View()); }
public ActionResult EditarResposta(int idPergunta, int idResposta, Resposta r) { ViewBag.idPergunta = idPergunta; ViewBag.idResposta = idResposta; ViewBag.DescPergunta = PerguntaDAO.buscarPerguntaID(idPergunta).des_Pergunta; int id = Convert.ToInt32(TempData["idLicao"]); int idAluno = Convert.ToInt16(System.Web.HttpContext.Current.User.Identity.Name.Split('|')[3]); if (ModelState.IsValid) { r.aluno = AlunoDAO.buscarAluno("id", idAluno.ToString()); r.pergunta = PerguntaDAO.buscarPerguntaID(idPergunta); if (RespostaDAO.addResposta(r)) { ViewBag.sucesso = true; return(RedirectToAction("verlicaoaluno/" + id, "aluno")); } else { ModelState.AddModelError("", "pergunta ja cadastrada!"); } } return(View(r)); }
public void Remover(Connection conn, SQLiteTransaction transaction) { using (var dao = new PerguntaDAO(conn)) { dao.Remove(this, transaction); } }
public ActionResult Responder(string id) { var dao = new PerguntaDAO(); ViewBag.Pergunta = dao.BuscaPorId(int.Parse(id)); return(View()); }
public ActionResult VerLicaoAluno(int id) { TempData["idLicao"] = id; ViewBag.listaDePerguntas = PerguntaDAO.listaPerguntas(id); int idAluno = Convert.ToInt16(System.Web.HttpContext.Current.User.Identity.Name.Split('|')[3]); ViewBag.listaDeRespostas = RespostaDAO.listaRespostas(id, idAluno); return(View(LicaoDAO.buscarLicaoID(id))); }
// GET: ForumDiscussex public ActionResult Index() { var dao = new PerguntaDAO(); IList <Pergunta> lista = dao.Lista(); ViewBag.ListaPerguntas = lista; return(View()); }
public ActionResult BuscarTemas(string busca) { var dao = new PerguntaDAO(); IList <Pergunta> lista = dao.BuscaPorPalavraChave(busca); Session["palavraChave"] = lista; return(RedirectToAction("Index", "ForumDiscussex")); }
public void Salvar(Connection conn, SQLiteTransaction transaction) { using (var dao = new PerguntaDAO(conn)) { if (Id == 0) { dao.Insert(this, transaction); } else { dao.Update(this, transaction); } } }
public static List <Pergunta> GetByIdAlternativa(int idAlternativa, bool somenteAtivas, Connection conn, SQLiteTransaction transaction) { using (var dao = new PerguntaDAO(conn)) { if (somenteAtivas) { return(dao.GetAtivasByIdAlternativa(idAlternativa, transaction)); } else { return(dao.GetByIdAlternativa(idAlternativa, transaction)); } } }
public static List <Pergunta> GetPrincipaisByTipoPergunta(TipoPergunta tipoPergunta, bool somenteAtivas, Connection conn, SQLiteTransaction transaction) { using (var dao = new PerguntaDAO(conn)) { if (somenteAtivas) { return(dao.GetPrincipaisAtivasByTipoPergunta(tipoPergunta, transaction)); } else { return(dao.GetPrincipaisByTipoPergunta(tipoPergunta, transaction)); } } }
public ActionResult ExcluirPergunta(int id) { Pergunta p = PerguntaDAO.buscarPerguntaID(id); int idLicao = p.licao.idLicao; bool result = PerguntaDAO.excluirPergunta(p); if (result) { ViewBag.SucessoExclusao = true; return(RedirectToAction("VerLicao/" + idLicao, "Professor")); } ViewBag.SucessoExclusao = false; return(RedirectToAction("VerLicao/" + idLicao, "Professor")); }
public ActionResult CadastrarPergunta(Pergunta pergunta, int idLicao) { if (ModelState.IsValid) { if (PerguntaDAO.addPergunta(pergunta)) { ViewBag.Sucesso = true; return(View()); } else { ModelState.AddModelError("", "Pergunta ja cadastrada!"); } } return(View(pergunta)); }
public ActionResult PagJogoC() { var questoes = new QuestaoDAO().BuscarPorFase(5); var respostas = new RespostaDAO().Buscar(5, ((Jogador)User).IdUsuario); if (questoes.Count == respostas.Count) { return(RedirectToAction("RankJ", "Rank")); } var questao = new PerguntaDAO().Buscar(5, ((Jogador)User).IdUsuario); while (questao == null) { questao = new PerguntaDAO().Buscar(5, ((Jogador)User).IdUsuario); } return(View(questao)); }
public ActionResult EditarPergunta(Pergunta p) { Pergunta pe = PerguntaDAO.buscarPerguntaID(p.idPergunta); int id = Convert.ToInt32(TempData["idLicao"]); try { pe.des_Pergunta = p.des_Pergunta; if (PerguntaDAO.editarPergunta(pe)) { ViewBag.Sucesso = true; return(RedirectToAction("VerLicao/" + pe.licao.idLicao, "Professor")); } } catch { ModelState.AddModelError("", "Não foi possivel editar sua Pergunta!"); return(View(pe)); } return(View(pe)); }
public ActionResult FazerPergunta(Pergunta p, bool anonimo) { if (Session["emailUsuario"] == null || anonimo) { p.CodUsuario = null; } else { var user = new UsuarioDAO(); Usuario usuario = user.BuscaPorEmail(Session["emailUsuario"].ToString()); p.CodUsuario = usuario.Id; } var dao = new PerguntaDAO(); dao.Adicionar(p); return(RedirectToAction("Respostas", "ForumDiscussex", new { id = p.Id })); }
public ActionResult InserirPerguntaLicao(Pergunta pergunta) { int id = Convert.ToInt32(TempData["idLicao"]); if (ModelState.IsValid) { pergunta.licao = LicaoDAO.buscarLicaoID(id); if (PerguntaDAO.addPergunta(pergunta)) { //Pergunta p = PerguntaDAO.buscarPergunta(pergunta); //PerguntaDAO.addPergunta(p); ViewBag.Sucesso = true; return(RedirectToAction("VerLicao/" + id, "Professor")); } else { ModelState.AddModelError("", "Pergunta ja cadastrada!"); } } return(RedirectToAction("VerLicao/" + id, "Professor")); }
public static string FazerPergunta(bool anonimo, string emailUsuario, Pergunta p) { if (emailUsuario == null || anonimo) { p.CodUsuario = null; } else { var user = new UsuarioDAO(); Usuario usuario = user.BuscaPorEmail(emailUsuario); if (usuario == null) { throw new Exception("Usuario não existe"); } p.CodUsuario = usuario.Id; } var dao = new PerguntaDAO(); return(dao.Adicionar(p)); }
public ActionResult EditarPergunta(int id) { return(View(PerguntaDAO.buscarPerguntaID(id))); }
public ActionResult VerLicao(int id) { TempData["idLicao"] = id; ViewBag.listaDePerguntas = PerguntaDAO.listaPerguntas(id); return(View(LicaoDAO.buscarLicaoID(id))); }
public CtrCadastroPergunta() { DAOFactory daoFactory = new DAOFactory(); perguntaDAO = daoFactory.getPerguntaDAO(); }