protected void Page_Load(object sender, EventArgs e) { Entidades.EntidadesPost post = new Entidades.EntidadesPost() { Id = Convert.ToInt32(Request.QueryString["id"]) }; if (post != null) { postNegocio.BorrarPost(post); } Response.Redirect("~/Post/ABMPost/ABMPost.aspx"); }
protected void btnAgregar_Click(object sender, EventArgs e) { Entidades.EntidadesPost post = new Entidades.EntidadesPost() { Titulo = txtTitulo.Text, Resumen = txtResumen.Text, Cuerpo = txtCuerpo.Text }; postNegocio.InsertarPost(post); Response.Redirect("~/Post/ABMPost/ABMPost.aspx"); }
protected void btnEditar_Click(object sender, EventArgs e) { Entidades.EntidadesPost post = new Entidades.EntidadesPost() { Id = Convert.ToInt32(Request.QueryString["id"]), Titulo = txtTitulo.Text, Resumen = txtResumen.Text, Cuerpo = txtCuerpo.Text }; postNegocio.ModificarPost(post); Response.Redirect("~/Post/ABMPost/ABMPost.aspx"); }
protected void Page_Load(object sender, EventArgs e) { string parametroId = Request.QueryString["id"]; int id = Convert.ToInt32(parametroId); Entidades.EntidadesPost elPost = postNegocio.ObtenerPost(id); if (elPost != null) { lblTitulo.Text = elPost.Titulo; lblResumen.Text = elPost.Resumen; lblCuerpo.Text = elPost.Cuerpo; List <CapaEntityFramework.Comentario> listado = comentarioNegocio.TodosLosComentarios(id); if (User.Identity.Name == "") { txtAutor.Visible = true; } else if (User.Identity.Name != null) { txtAutor.Visible = false; lblAutor.Text = "Autor: " + User.Identity.Name; } if (User.IsInRole("admin")) { pnlAdmin.Visible = true; lstComentarios.DataSource = listado; lstComentarios.DataBind(); } else if (User.IsInRole("admin") != true || User.Identity.Name == "") { pnlUser.Visible = true; ListView1.DataSource = listado; ListView1.DataBind(); } } else { Response.Redirect("~/Default.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack == false) { int id = Convert.ToInt32(Request.QueryString["id"]); Entidades.EntidadesPost post = postNegocio.ObtenerPost(id); if (post == null) { Response.Redirect("~/Post/ABMPost/ABMPost.aspx"); } else { txtTitulo.Text = post.Titulo; txtResumen.Text = post.Resumen; txtCuerpo.Text = post.Cuerpo; } } }