コード例 #1
0
        //
        // 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);
        }
コード例 #2
0
        public ActionResult Create(TopicInput input)
        {
            try
            {
                // TODO: Add insert logic here

                return RedirectToAction("Details", new {Id = 123});
            }
            catch
            {
                return View();
            }
        }
コード例 #3
0
        //
        // 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);
        }
コード例 #4
0
        public ActionResult Edit(int id, TopicInput input)
        {
            try
            {
                // TODO: Add update logic here

                return RedirectToAction("Details", new {Id = id});
            }
            catch
            {
                return View();
            }
        }