public IList <Nome> Lista(String nome) { using (var contexto = new AgendaContext()) { return(contexto.Nomes.Where(p => p.NomeContato.Contains(nome)).ToList()); } }
public Email BuscaPorId(int id) { using (var contexto = new AgendaContext()) { return(contexto.Emails.Find(id)); } }
public void Atualiza(Email email) { using (var contexto = new AgendaContext()) { //try //{ contexto.Entry(email).State = System.Data.Entity.EntityState.Modified; contexto.SaveChanges(); //} //catch (DbEntityValidationException e) //{ // foreach (var eve in e.EntityValidationErrors) // { // System.Diagnostics.Debug.WriteLine("Entidade do tipo \"{0}\" com estado \"{1}\" tem os seguintes erros de validação:", // eve.Entry.Entity.GetType().Name, eve.Entry.State); // foreach (var ve in eve.ValidationErrors) // { // System.Diagnostics.Debug.WriteLine("- Propriedade: \"{0}\", Error: \"{1}\"", // ve.PropertyName, ve.ErrorMessage); // } // } //} } }
public Telefone BuscaPorId(int id) { using (var contexto = new AgendaContext()) { return(contexto.Telefones.Find(id)); } }
public IList <Email> Lista() { using (var contexto = new AgendaContext()) { return(contexto.Emails.Include("NomeContato").ToList()); } }
public IList <Telefone> Lista() { using (var contexto = new AgendaContext()) { return(contexto.Telefones.Include("NomeContato").ToList()); } }
public Nome BuscaPorId(int id) { using (var contexto = new AgendaContext()) { return(contexto.Nomes.Find(id)); } }
public IList <Nome> Lista() { using (var contexto = new AgendaContext()) { return(contexto.Nomes.ToList()); } }
public void Adiciona(Email email) { using (var context = new AgendaContext()) { context.Emails.Add(email); context.SaveChanges(); } }
public void Atualiza(Telefone telefone) { using (var contexto = new AgendaContext()) { contexto.Entry(telefone).State = System.Data.Entity.EntityState.Modified; contexto.SaveChanges(); } }
public void Adiciona(Telefone telefone) { using (var context = new AgendaContext()) { context.Telefones.Add(telefone); context.SaveChanges(); } }
public void Adiciona(Nome nome) { using (var context = new AgendaContext()) { context.Nomes.Add(nome); context.SaveChanges(); } }