Exemplo n.º 1
0
 public void Salvar(Aluno aluno)
 {
     if (aluno.AlunoId > 0)
         Alterar(aluno);
     else
         Inserir(aluno);
 }
Exemplo n.º 2
0
 public void Inserir(Aluno aluno)
 {
     var strQuery = "";
     strQuery += string.Format("Insert into Aluno (AlunoNome, AlunoLogin, AlunoSenha, AlunoEmail, AlunoRG, AlunoTelefone) values('{0}','{1}','{2}','{3}','{4}','{5}')",
         aluno.AlunoNome, aluno.Login, aluno.Senha, aluno.AlunoEmail, aluno.AlunoRG, aluno.AlunoTelefone);
     contexto.ExecutaComando(strQuery);
 }
Exemplo n.º 3
0
 public void Alterar(Aluno aluno)
 {
     var strQuery = "";
     strQuery += string.Format("UPDATE Aluno SET AlunoNome ='{0}', AlunoLogin = '******', AlunoSenha = '{2}', AlunoEmail = '{3}', AlunoRG = '{4}', AlunoTelefone = '{5}' WHERE AlunoId = {6}",
         aluno.AlunoNome, aluno.Login, aluno.Senha, aluno.AlunoEmail, aluno.AlunoRG, aluno.AlunoTelefone, aluno.AlunoId);
     contexto.ExecutaComando(strQuery);
 }
Exemplo n.º 4
0
 //
 // GET: /Cadastro/
 public void Cadastro(Aluno aluno)
 {
     var strQuery = "";
     strQuery += string.Format("Insert into ALUNO (AlunoLogin,AlunoSenha) values('{0}','{1}')",
         aluno.Login, aluno.Senha);
     contexto.ExecutaComando(strQuery);
 }
 public ActionResult Cadastro(Aluno aluno)
 {
     if (ModelState.IsValid)
     {
         var alunoAplicacao = new AlunoAplicacao();
         alunoAplicacao.Inserir(aluno);
         return RedirectToAction("Index", "Home");
     }
     return View();
 }
Exemplo n.º 6
0
        private List<Aluno> TransformaReaderEmListaDeObjeto(SqlDataReader reader)
        {
            var aluno = new List<Aluno>();
            while (reader.Read())
            {
                var tempObjeto = new Aluno
                                     {
                    AlunoId = int.Parse(reader["AlunoId"].ToString()),
                    Login = reader["Descricao"].ToString(),
                    Senha = reader["Descricao"].ToString(),
                    AlunoNome = reader["NomeDoCurso"].ToString(),
                    AlunoEmail = reader["Descricao"].ToString(),
                    AlunoRG = reader["Descricao"].ToString(),
                    AlunoTelefone = reader["Descricao"].ToString()

                };
                aluno.Add(tempObjeto);
            }
            return aluno;
        }