Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack == false)
            {
                int intId = Convert.ToInt32(Request.QueryString["id"]);

                CapaEntityFramework.Comentario comentario = comentarioNegocio.ObtenerComentario(intId);
                txtAutor.Text      = comentario.Autor;
                txtComentario.Text = comentario.Comentario1;
            }
        }
Example #2
0
        protected void btnEditarComentario_Click(object sender, EventArgs e)
        {
            int intId = Convert.ToInt32(Request.QueryString["id"]);

            CapaEntityFramework.Comentario comentarionuevo = new CapaEntityFramework.Comentario()
            {
                Id          = Convert.ToInt32(Request.QueryString["id"]),
                Autor       = txtAutor.Text,
                Comentario1 = txtComentario.Text,
                IdPost      = Convert.ToInt32(Request.QueryString["idPost"])
            };
            comentarioNegocio.EditarComentario(comentarionuevo);
            Response.Redirect($"~/Post/verPost.aspx?id={Convert.ToInt32(Request.QueryString["idPost"])}");
        }
Example #3
0
        protected void btn_AgregarComentario_Click(object sender, EventArgs e)
        {
            string autor = txtAutor.Text == "" ? User.Identity.Name : txtAutor.Text;
            int    id    = Convert.ToInt32(Request.QueryString["id"]);

            if (autor != "" && txtComentario.Text != "")
            {
                CapaEntityFramework.Comentario comentario = new CapaEntityFramework.Comentario()
                {
                    Autor       = autor,
                    Comentario1 = txtComentario.Text,
                    IdPost      = Convert.ToInt32(Request.QueryString["id"])
                };
                comentarioNegocio.AgregarComentario(comentario);
            }
            Response.Redirect($"~/Post/verPost.aspx?id={id}");
        }