// // GET: /Topic/Create?ForumId=123 public ActionResult Create(int forumId) { ViewData["Forum"] = "The forum in the current context"; var topic = new TopicInput { ForumId = forumId }; return View(topic); }
public ActionResult Create(TopicInput input) { try { // TODO: Add insert logic here return RedirectToAction("Details", new {Id = 123}); } catch { return View(); } }
// // GET: /Topic/Edit/5 public ActionResult Edit(int id) { ViewData["Forum"] = "This is the forum for the current context"; var topic = new TopicInput { ForumId = 321, Body = "This is the body of text to edit for the selected topic", IsSticky = false, Title = "Title of the topic" }; return View(topic); }
public ActionResult Edit(int id, TopicInput input) { try { // TODO: Add update logic here return RedirectToAction("Details", new {Id = id}); } catch { return View(); } }