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