//takes a thread id public ActionResult Create(int id) { Post post = new Post(); post.ThreadId = id; post.DateCreated = DateTime.Now; return View(post); }
public ActionResult Create(Post post) { post.UserId = User.Identity.GetUserId(); post.DateCreated = DateTime.Now; db.Posts.Add(post); db.SaveChanges(); return RedirectToAction("Thread", "Thread", new { id = post.ThreadId }); }