public Boolean guardar(clsTipoCombustible ctm, ref string Mensaje) { try { using (INVENTARIOEntities te = new INVENTARIOEntities()) { TipoCombustible tm = new TipoCombustible(); tm.IdEmpresa = Convert.ToInt32(ctm.empresa); tm.IdTipoCombustible = Convert.ToInt32(ctm.codigo); tm.Descripcion = Convert.ToString(ctm.descripcion); tm.IdEstado = Convert.ToInt32(ctm.codigo); te.AddToTipoCombustible(tm); te.SaveChanges(); } return true; } catch (Exception e) { Mensaje = "ERROR" + e.InnerException + e.Message; //System.Windows.Forms.MessageBox.Show("error al guardar" + e); return false; } }