Exemplo n.º 1
0
 public ActionResult Edit([Bind(Include = "Id,Email,EmailConfirmed,PasswordHash,SecurityStamp,PhoneNumber,PhoneNumberConfirmed,TwoFactorEnabled,LockoutEndDateUtc,LockoutEnabled,AccessFailedCount,UserName")] AspNetUser aspNetUser)
 {
     if (ModelState.IsValid)
     {
         db.Entry(aspNetUser).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(aspNetUser));
 }
Exemplo n.º 2
0
 // Comment table
 public static bool AddComment(Comment comment)
 {
     using (Model2Container ctx = new Model2Container())
     {
         bool bResult = false;
         if (comment == null || comment.PostPostId == 0)
         {
             return(bResult);
         }
         if (comment.Id == 0)
         {
             ctx.Entry <Comment>(comment).State = EntityState.Added;
             Post p = ctx.Posts.Find(comment.PostPostId);
             ctx.Entry <Post>(p).State = EntityState.Unchanged;
             ctx.SaveChanges();
             bResult = true;
         }
         return(bResult);
     }
 }
Exemplo n.º 3
0
 public static bool AddPost(Post post)
 {
     using (Model2Container ctx = new Model2Container())
     {
         bool bResult = false;
         if (post.PostId == 0)
         {
             var it = ctx.Entry <Post>(post).State = EntityState.Added;
             ctx.SaveChanges();
             bResult = true;
         }
         return(bResult);
     }
 }