Ejemplo n.º 1
0
 public ActionResult Create([Bind(Include = "Title,Content,Tags")] PostView postView)
 {
     if (ModelState.IsValid)
     {
         if (Session["ParentPost"] != null)
         {
             postView.ParentPostId = ((Post)Session["ParentPost"]).Id;
         }
         else
         {
             postView.ParentPostId = 0;
         }
         postView.UserId       = OnlineUsers.CurrentUser.Id;
         postView.CreationDate = DateTime.Now;
         db.AddPost(postView);
         return(RedirectToAction("Index"));
     }
     return(View(postView));
 }