protected void UpdateButton_Click(object sender, EventArgs e) { current = (from paste in context.Pastes where (current.pasteId == paste.pasteId) select paste).First(); current.content = code.Text; context.SaveChanges(); Response.Redirect("admin_pastes.aspx"); }
protected void Page_Load(object sender, EventArgs e) { if (Session["user"] == null || (Session["user"] as Models.User).status != "admin") Response.Redirect("Pastes.aspx"); current = (Models.Paste)Session["current_paste"]; if (current == null) current = new Models.Paste(); if (!Page.IsPostBack) { this.DataBind(); } }