public void Save(cod_prestador oPrestador) { cooperativaEntities bd = new cooperativaEntities(); bd.cod_prestador.AddObject(oPrestador); bd.SaveChanges(); }
public void CargarCombo(ComboBox combo, string InsertaFila) { IList ListaPrestador = GetAll(); cod_prestador oPrestador = new cod_prestador(); oPrestador.id_prestador = 0; oPrestador.prestador = InsertaFila; ListaPrestador.Insert(0, oPrestador); combo.DisplayMember = "prestador"; combo.ValueMember = "id_prestador"; combo.DataSource = ListaPrestador; }
public void Update(cod_prestador oPrestador) { using (cooperativaEntities bd = new cooperativaEntities()) { var editar = (from p in bd.cod_prestador where p.id_prestador == oPrestador.id_prestador select p).Single(); editar.prestador = oPrestador.prestador; bd.SaveChanges(); } }
public cod_prestador Get(int id) { cod_prestador oPrestador = new cod_prestador(); using (cooperativaEntities bd = new cooperativaEntities()) { var regis = (from p in bd.cod_prestador where p.id_prestador == id select p).Single(); oPrestador.id_prestador = regis.id_prestador; oPrestador.prestador = regis.prestador; return(oPrestador); } }