Ejemplo n.º 1
0
 //takes a thread id
 public ActionResult Create(int id)
 {
     Post post = new Post();
     post.ThreadId = id;
     post.DateCreated = DateTime.Now;
     return View(post);
 }
Ejemplo n.º 2
0
 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 });
 }