public ActionResult Edit([Bind(Include = "UserId,UserName,UserPassword,UserType,UserEmail,UserProfilePicture")] User user) { if (ModelState.IsValid) { db.Entry(user).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(user)); }
public ActionResult Edit([Bind(Include = "PostId,PostTitle,PostType,PostDate,PostImage,PostContent,UserId")] Post post) { if (ModelState.IsValid) { db.Entry(post).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.UserId = new SelectList(db.Users, "UserId", "UserName", post.UserId); return(View(post)); }
public ActionResult Edit([Bind(Include = "CommentId,CommentContent,CommentDate,UserId,PostId")] Comment comment) { if (ModelState.IsValid) { db.Entry(comment).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.PostId = new SelectList(db.Posts, "PostId", "PostTitle", comment.PostId); ViewBag.UserId = new SelectList(db.Users, "UserId", "UserName", comment.UserId); return(View(comment)); }