public ActionResult Ask(AskInputModel input) { if (ModelState.IsValid) { var userId = this.User.Identity.GetUserId(); var post = new Post { Title = input.Title, Content = this.sanitizer.Sanitize(input.Content), AuthorId = userId, // 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); }
public ActionResult Ask() { var model = new AskInputModel(); return this.View(model); }