Пример #1
0
 public bool Save(Tweet tweet)
 {
     using (var dbItem = new TwitterEntities())
     {
         dbItem.Tweets.Attach(tweet);
         dbItem.Entry(tweet).State = EntityState.Modified;
         return dbItem.SaveChanges() > 0;
     }
 }
Пример #2
0
 public bool Activated(string email)
 {
     using (var dbContext = new TwitterEntities())
     {
          var result = dbContext.Users.Where(currentUser => currentUser.Email == email).FirstOrDefault();
          result.Activated = true;
          dbContext.Users.Attach(result);
          dbContext.Entry(result).State = EntityState.Modified;
         if ( dbContext.SaveChanges() > 0)
             return true;
         else
             return false;
     }
 }
Пример #3
0
 public bool Save(User user)
 {
     using (var dbContext = new TwitterEntities())
     {
         dbContext.Users.Attach(user);
         dbContext.Entry(user).State = EntityState.Modified;
         dbContext.SaveChanges();
         return true;
     }
 }