public ActionResult Create(Blog blog) { using (IDataRepository<Blog> repository = new DataRepository<Blog>()) { blog.BlogId = Guid.NewGuid(); repository.Create(blog); repository.SaveChanges(); } return this.RedirectToAction(a => a.Index()); }
/// <summary> /// Initializes a new instance of the HomeViewModel class /// </summary> /// <param name="blogPosts">The blog posts to display on the admin page</param> /// <param name="authors">A list of authors that are associated with the requested blog</param> /// <param name="currentBlog">The curent blog</param> public AdminViewModel(IList<BlogPost> blogPosts, IList<aspnet_Users> authors, Blog currentBlog) : base(blogPosts) { Authors = authors; CurrentBlog = currentBlog; }
/// <summary> /// Deprecated Method for adding a new object to the Blogs EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToBlogs(Blog blog) { base.AddObject("Blogs", blog); }
/// <summary> /// Create a new Blog object. /// </summary> /// <param name="blogId">Initial value of the BlogId property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="friendlyName">Initial value of the FriendlyName property.</param> /// <param name="maxHomePagePosts">Initial value of the MaxHomePagePosts property.</param> /// <param name="showResume">Initial value of the ShowResume property.</param> public static Blog CreateBlog(global::System.Guid blogId, global::System.String name, global::System.String friendlyName, global::System.Int32 maxHomePagePosts, global::System.Boolean showResume) { Blog blog = new Blog(); blog.BlogId = blogId; blog.Name = name; blog.FriendlyName = friendlyName; blog.MaxHomePagePosts = maxHomePagePosts; blog.ShowResume = showResume; return blog; }