예제 #1
0
 public IList <Aluno> Lista()
 {
     using (var contexto = new SAEContext())
     {
         return(contexto.Alunos.Include("AlunoSituacao").ToList());
     }
 }
예제 #2
0
 public Aluno BuscaPorId(int id)
 {
     using (var contexto = new SAEContext())
     {
         return(contexto.Alunos.Find(id));
     }
 }
예제 #3
0
 public void Atualiza(Aluno Aluno)
 {
     using (var contexto = new SAEContext())
     {
         contexto.Entry(Aluno).State = System.Data.Entity.EntityState.Modified;
         contexto.SaveChanges();
     }
 }
예제 #4
0
 public void Adiciona(Aluno aluno)
 {
     using (var context = new SAEContext())
     {
         context.Alunos.Add(aluno);
         context.SaveChanges();
     }
 }
예제 #5
0
 public List <Aluno> BuscaPorNome(string nome)
 {
     using (var contexto = new SAEContext())
     {
         //List<Aluno> lstPerson = contexto.GetTable<Aluno>().StartWith(c => c.nome).ToList();
         List <Aluno> lstPerson2 = contexto.Alunos.Where(c => c.Nome.StartsWith(nome)).ToList();
         return(lstPerson2);
         //contexto.Alunos.Where(u => u.Nome as nome)
     }
 }