Exemplo n.º 1
0
 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));
 }
Exemplo n.º 2
0
 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));
 }
Exemplo n.º 3
0
 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));
 }