public async Task UpdateUser(User user)
        {
            if (await _dbContext.Users.CountAsync(u => u == user) == 0)
            {
                throw new Exception($"User with Id {user.Id} is not found.");
            }

            _dbContext.Entry(user).State = EntityState.Modified;
        }
예제 #2
0
        public async Task UpdateRelationship(Relationship relationship)
        {
            if (await _dbContext.Relationships.CountAsync(r => r.Id == relationship.Id) == 0)
            {
                throw new Exception($"Relationship with Id {relationship.Id} is not found");
            }

            _dbContext.Entry(relationship).State = EntityState.Modified;
        }