using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using CareersOnlineLibrary; using CareersOnlineLibrary.Entity; using CareersOnlineLibrary.Controller; namespace WebApplication1.Blogs { public partial class BlogEntry1 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void btnSubmit_Click(object sender, EventArgs e) { // record the blog data in the Session State Session["Title"] = this.txtTitle.Text; Session["Blog"] = this.txtBlog.Text; Session["Name"] = this.txtName.Text; Session["Changed"] = true; //Save Blog entry // initialize Blog and read it into a blog collection CareersOnlineController controller = new CareersOnlineController(); Blog blog = new Blog(); blog.Title = this.txtTitle.Text; blog.BlogComment = this.txtBlog.Text; blog.Name = this.txtName.Text; controller.CreateBlogEntry(blog); blog = null; controller = null; // redirect backt to the main blog page this.Response.Redirect("~/Blogs/BlogList.aspx"); } protected void btnClear_Click(object sender, EventArgs e) { this.txtTitle.Text = ""; this.txtBlog.Text = ""; this.txtName.Text = ""; } } }