public Boolean guardar(clsTipoMaterial ctm, ref string Mensaje) { try { using (INVENTARIOEntities te = new INVENTARIOEntities()) { TipoMaterial tm = new TipoMaterial(); tm.IdEmpresa = Convert.ToInt32(ctm.empresa); tm.IdTipoMaterial = ctm.codigo; tm.Descripcion = ctm.descripcion; // IdUsuario = Convert.ToInt32(ctm.usuario), tm.IdEstado = Convert.ToInt32(ctm.estado); te.AddToTipoMaterial(tm); te.SaveChanges(); } return true; } catch (Exception e) { Mensaje = "ERROR" + e.InnerException + e.Message; //Console.WriteLine("ERROR" + e); return false; } }