public ActionResult Create([Bind(Include = "FanId,FName,LName,Genre,BDate,Seniority")] Fan fan) { if (ModelState.IsValid) { db.Fans.Add(fan); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(fan)); }
public ActionResult Create(Post post) { if (ModelState.IsValid) { db.Posts.Add(post); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(post)); }
public ActionResult CreateComment(Comment comment) { if (ModelState.IsValid) { // Add new comment to Comment table in DB db.Comments.Add(comment); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(comment)); }
public PartialViewResult _SubmitComment(Comment comment) { comment.CreateAt = DateTime.Now; Repository.Comments.Add(comment); Repository.SaveChanges(); ViewBag.PostId = comment.PostId; var comments = Repository.Comments.Where(x => x.PostId == comment.PostId).ToList(); return(PartialView("_GetForPost", comments)); }