Example #1
0
 public string excluirEndereco(endereco endereco)
 {
     string erro = null;
     try
     {
         enderecos.DeleteObject(endereco);
         db.SaveChanges();
     }
     catch (Exception ex)
     {
         erro = ex.Message;
     }
     return erro;
 }
Example #2
0
 public string adicionarEndereco(endereco endereco)
 {
     string erro = null;
     try
     {
         enderecos.AddObject(endereco);
         db.SaveChanges();
     }
     catch (Exception ex)
     {
         erro = ex.Message;
     }
     return erro;
 }
Example #3
0
        public string editarEndereco(endereco endereco)
        {
            string erro = null;
            try
            {
                if (endereco.EntityState == System.Data.EntityState.Detached)
                {
                    enderecos.Attach(endereco);
                }
                db.ObjectStateManager.ChangeObjectState(endereco, System.Data.EntityState.Modified);

                db.SaveChanges();
            }
            catch (Exception ex)
            {
                erro = ex.Message;
            }
            return erro;
        }
 /// <summary>
 /// Create a new endereco object.
 /// </summary>
 /// <param name="idPessoa">Initial value of the IdPessoa property.</param>
 /// <param name="logradouro">Initial value of the Logradouro property.</param>
 /// <param name="bairro">Initial value of the Bairro property.</param>
 /// <param name="idLogradouro">Initial value of the IdLogradouro property.</param>
 /// <param name="idCidade">Initial value of the IdCidade property.</param>
 public static endereco Createendereco(global::System.Int16 idPessoa, global::System.String logradouro, global::System.String bairro, global::System.SByte idLogradouro, global::System.SByte idCidade)
 {
     endereco endereco = new endereco();
     endereco.IdPessoa = idPessoa;
     endereco.Logradouro = logradouro;
     endereco.Bairro = bairro;
     endereco.IdLogradouro = idLogradouro;
     endereco.IdCidade = idCidade;
     return endereco;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the endereco EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToendereco(endereco endereco)
 {
     base.AddObject("endereco", endereco);
 }