public static void InsertAluno(Aluno aluno) { if (ListaAlunos == null) { ListaAlunos = new ObservableCollection <Aluno>(); } ListaAlunos.Add(aluno); }
private void btnRemoverAluno_Click(Guid guid) { var alunoExcluir = (from x in ListaAlunos where x.Id == guid select x).FirstOrDefault(); if (alunoExcluir != null) { ListaAlunos.Remove(alunoExcluir); } }
//Create Retrieve Update Delete public void updateAluno(aluno a) { int aqui = 0; using (progIInoitesegEntities bd = new progIInoitesegEntities()) { var este = bd.alunos.Where(x => x.num == a.num).First(); if (este != null) { aqui = este.num; este.nome = a.nome; este.curso = a.curso; este.fotopath = a.fotopath; bd.SaveChanges(); } reset(); var novo = ListaAlunos.Where(x => x.num == aqui).First(); AlunosView.MoveCurrentTo(novo); System.Windows.MessageBox.Show("Registo gravado."); } }
public void AddAlunos(ListaAlunos item) { contextDB.listaDeAlunos.Add(item); contextDB.SaveChanges(); }