示例#1
0
 public string excluirTelefone(telefone telefone)
 {
     string erro = null;
     try
     {
         telefones.DeleteObject(telefone);
         db.SaveChanges();
     }
     catch (Exception ex)
     {
         erro = ex.Message;
     }
     return erro;
 }
示例#2
0
        public string editarTelefone(telefone telefone)
        {
            string erro = null;
            try
            {
                if (telefone.EntityState == System.Data.EntityState.Detached)
                {
                    telefones.Attach(telefone);
                }
                db.ObjectStateManager.ChangeObjectState(telefone, System.Data.EntityState.Modified);

                db.SaveChanges();
            }
            catch (Exception ex)
            {
                erro = ex.Message;
            }
            return erro;
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the telefone EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTotelefone(telefone telefone)
 {
     base.AddObject("telefone", telefone);
 }
 /// <summary>
 /// Create a new telefone object.
 /// </summary>
 /// <param name="idPessoa">Initial value of the IdPessoa property.</param>
 /// <param name="numero">Initial value of the Numero property.</param>
 public static telefone Createtelefone(global::System.Int16 idPessoa, global::System.Int32 numero)
 {
     telefone telefone = new telefone();
     telefone.IdPessoa = idPessoa;
     telefone.Numero = numero;
     return telefone;
 }