public ViewResult AddBlogPost(BlogPost blogPost)
        {
            ViewData["type"] = "add";
            blogPost.FriendlyUrl = Url.ToFriendlyUrl(blogPost.Title);
            blogPost.Author = User.Identity.Name;
            blogPost.Date = DateTime.Now;
            if (!ModelState.IsValid)
                return View("ManageBlogPost");

            db.BlogPosts.AddObject(blogPost);
            db.SaveChanges();
            ViewData["message"] = "Blog post added successfully.";
            ViewData["returnUrl"] = Url.Action("ManageBlogPosts");
            return View("Result");
        }
 /// <summary>
 /// Create a new BlogPost object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="author">Initial value of the Author property.</param>
 /// <param name="date">Initial value of the Date property.</param>
 /// <param name="title">Initial value of the Title property.</param>
 /// <param name="body">Initial value of the Body property.</param>
 /// <param name="friendlyUrl">Initial value of the FriendlyUrl property.</param>
 public static BlogPost CreateBlogPost(global::System.Int32 id, global::System.String author, global::System.DateTime date, global::System.String title, global::System.String body, global::System.String friendlyUrl)
 {
     BlogPost blogPost = new BlogPost();
     blogPost.Id = id;
     blogPost.Author = author;
     blogPost.Date = date;
     blogPost.Title = title;
     blogPost.Body = body;
     blogPost.FriendlyUrl = friendlyUrl;
     return blogPost;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the BlogPosts EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToBlogPosts(BlogPost blogPost)
 {
     base.AddObject("BlogPosts", blogPost);
 }