public void Excluir(int id) { using (contexto = new Contexto()) { var strQuery = string.Format(" DELETE FROM ALUNO WHERE AlunoId = {0}", id); contexto.ExecutaComando(strQuery); } }
public void Deletar(int id) { var strQuery = string.Format("DELETE FROM Aluno WHERE AlunoId = {0}", id); using (contexto = new Contexto()) { contexto.ExecutaComando(strQuery); } }
public List<Aluno> ListarTodos() { using (contexto = new Contexto()) { var strQuery = " SELECT * FROM ALUNO "; var retornoDataReader = contexto.ExecutaComandoComRetorno(strQuery); return TransformaReaderEmListaDeObjeto(retornoDataReader); } }
public Aluno ListarPorId(int id) { using (contexto = new Contexto()) { var strQuery = string.Format(" SELECT * FROM ALUNO WHERE AlunoId = {0} ", id); var retornoDataReader = contexto.ExecutaComandoComRetorno(strQuery); return TransformaReaderEmListaDeObjeto(retornoDataReader).FirstOrDefault(); } }
public void Alterar(Aluno aluno) { var strQuery = string.Format("UPDATE Aluno SET Nome = '{0}' , Mae = '{1}' , DataNascimento = '{2}' WHERE AlunoId = {3}", aluno.Nome, aluno.Mae, aluno.DataNascimento, aluno.Id); using (contexto = new Contexto()) { contexto.ExecutaComando(strQuery); } }
public void Inserir(Aluno aluno) { string strQuery = string.Format("INSERT INTO Aluno (Nome,Mae,DataNascimento) VALUES ('{0}','{1}','{2}')", aluno.Nome, aluno.Mae, aluno.DataNascimento); using (contexto = new Contexto()) { contexto.ExecutaComando(strQuery); } }
private void Inserir(Aluno aluno) { var strQuery = ""; strQuery += " INSERT INTO ALUNO (Nome, Mae, DataNascimento) "; strQuery += string.Format(" VALUES ('{0}','{1}','{2}') ", aluno.Nome, aluno.Mae, aluno.DataNascimento ); using (contexto = new Contexto()) { contexto.ExecutaComando(strQuery); } }
private void Alterar(Aluno aluno) { var strQuery = ""; strQuery += " UPDATE ALUNO SET "; strQuery += string.Format(" Nome = '{0}', ", aluno.Nome); strQuery += string.Format(" Mae = '{0}', ", aluno.Mae); strQuery += string.Format(" DataNascimento = '{0}' ", aluno.DataNascimento); strQuery += string.Format(" WHERE AlunoId = {0} ", aluno.Id); using (contexto = new Contexto()) { contexto.ExecutaComando(strQuery); } }