public ActionResult Edit(BlogAuthor blogauthor) { if (ModelState.IsValid) { db.BlogAuthors.Attach(blogauthor); db.ObjectStateManager.ChangeObjectState(blogauthor, EntityState.Modified); db.SaveChanges(); return RedirectToAction("Index"); } return View(blogauthor); }
public ActionResult Create(BlogAuthor blogauthor) { if (ModelState.IsValid) { db.BlogAuthors.AddObject(blogauthor); db.SaveChanges(); return RedirectToAction("Index"); } return View(blogauthor); }
/// <summary> /// Deprecated Method for adding a new object to the BlogAuthors EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToBlogAuthors(BlogAuthor blogAuthor) { base.AddObject("BlogAuthors", blogAuthor); }
/// <summary> /// Create a new BlogAuthor object. /// </summary> /// <param name="authorID">Initial value of the AuthorID property.</param> /// <param name="authorName">Initial value of the AuthorName property.</param> public static BlogAuthor CreateBlogAuthor(global::System.Int32 authorID, global::System.String authorName) { BlogAuthor blogAuthor = new BlogAuthor(); blogAuthor.AuthorID = authorID; blogAuthor.AuthorName = authorName; return blogAuthor; }