コード例 #1
0
 public void Update(Organization Entity)
 {
     try
     {
         _db = new SocialAppEntities();
         _db.Entry(Entity).State = EntityState.Modified;
         _db.SaveChanges();
     }
     catch (Exception)
     {
         throw new NotImplementedException();
     }
 }
コード例 #2
0
        public void Save(UserFriend userFriend)
        {
            if (userFriend.UserFriendID > 0)
            {
                var oldRecord = _dbContext.UserFriends.Find(userFriend.UserFriendID);
                oldRecord.IsRequestPending = userFriend.IsRequestPending;
                _dbContext.UserFriends.Attach(oldRecord);
                _dbContext.Entry(oldRecord).State = EntityState.Modified;
            }
            else
            {
                _dbContext.UserFriends.Add(userFriend);
            }

            _dbContext.SaveChanges();
        }