コード例 #1
0
        public ActionResult Ask(AskInputModel input)
        {
            if (ModelState.IsValid)
            {
                var post = (new Post
                {
                    Title = input.Title,
                    Content = this.sanitizer.Sanitize(input.Content)
                    // TODO: Tags
                    // TODO: Author
                });

                this.posts.Add(post);
                this.posts.SaveChanges();
                return this.RedirectToAction("Display", new { id = post.Id, url = "new" });
            }
            return this.View(input);
        }
コード例 #2
0
 public ActionResult Ask()
 {
     var model = new AskInputModel();
     return this.View(model);
 }