Example #1
0
 public void Alterar(AMIGO oAmigo, bool attach = true)
 {
     if (attach)
     {
         odb.Entry(oAmigo).State = System.Data.Entity.EntityState.Modified;
     }
     odb.SaveChanges();
 }
Example #2
0
        private bool VerificaLogin(string Email, string Senha)
        {
            AMIGO oAmigo = repositoryAmigo.VerificaLogin(Email, Senha);

            if (oAmigo != null)
            {
                return(true);
            }

            return(false);
        }
        private void BtnExcluir_Click(object sender, EventArgs e)
        {
            AMIGO oAmigo;

            oAmigo = _Control.SelecionarID(Convert.ToInt32(TxtIDAmigo.Text));
            if (Mensagens.MsgPerguntaExclusao() == DialogResult.Yes)
            {
                _Control.Excluir(oAmigo);
                LimpaDados();
                Mensagens.MsgExcluido();
                this.Close();
            }
        }
        private void GrdAmigos_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            AMIGO oAmigo = ((AMIGO)GrdAmigos.Rows[e.RowIndex].DataBoundItem);

            if (GrdAmigos.Rows[e.RowIndex].DataBoundItem != null)
            {
                if (GrdAmigos.Columns[e.ColumnIndex].Name == "BtnEscolher")
                {
                    TelaCadastroAmigo frmAmigo = new TelaCadastroAmigo(oAmigo);
                    frmAmigo.MdiParent = this.MdiParent;
                    frmAmigo.Show();
                    this.Close();
                }
            }
        }
Example #5
0
        public ActionResult Create(AMIGO oAmigo, HttpPostedFileBase imagem)
        {
            if (ModelState.IsValid)
            {
                // Upload Imagem
                string path = String.Empty;
                string pic  = String.Empty;

                if (imagem != null)
                {
                    pic  = Path.GetFileName(imagem.FileName);
                    path = Path.Combine(Server.MapPath("~/Content/imagens"), pic);
                    imagem.SaveAs(pic);
                }

                _repositoryAmigo.Incluir(oAmigo);
                return(RedirectToAction("Signin", "Login"));
            }

            return(View(oAmigo));
        }
 public TelaCadastroAmigo(AMIGO amigo)
 {
     InitializeComponent();
     _amigo = amigo;
     PopulaCampos();
 }
Example #7
0
 /// <summary>
 /// Metodo para eliminar una amistad :(.
 /// </summary>
 /// <param name="pAmigo"> Es un objeto tipo amigo, se debe de
 ///                   ingresar en el cuerpo del llamado a
 ///                   la pagina web.</param>
 public string Delete([FromBody] AMIGO pAmigo)
 {
     dbEntities.usp_DelAmigo(pAmigo.AA_userID, pAmigo.AA_amigoID);
     dbEntities.SaveChanges();
     return(respond);
 }
Example #8
0
 public void Excluir(AMIGO oAmigo)
 {
     _Repository.Excluir(oAmigo);
 }
Example #9
0
 public void Alterar(AMIGO oAmigo, bool attach = true)
 {
     _Repository.Alterar(oAmigo, attach);
 }
Example #10
0
 public void Incluir(AMIGO oAmigo)
 {
     _Repository.Incluir(oAmigo);
 }
Example #11
0
 public void Excluir(AMIGO oAmigo)
 {
     odb.AMIGO.Attach(oAmigo);
     odb.AMIGO.Remove(oAmigo);
     odb.SaveChanges();
 }
Example #12
0
 public void Incluir(AMIGO oAmigo)
 {
     odb.AMIGO.Add(oAmigo);
     odb.SaveChanges();
 }