Пример #1
0
        public static UserDto MergeUserWithAzureData(User userFromRepo, Microsoft.Graph.User userFromAzureAd,
                                                     IMapper mapper)
        {
            var dtoFromDb = mapper.Map <UserDto>(userFromRepo);

            return(mapper.Map(userFromAzureAd, dtoFromDb));
        }
Пример #2
0
        public void DeleteUser(User user)
        {
            if (user == null)
            {
                throw new ArgumentNullException(nameof(user));
            }

            _context.Users.Remove(user);
        }
Пример #3
0
        public void UpdateUser(User user)
        {
            foreach (var smartLockUser in user.SmartLockUsers)
            {
                smartLockUser.UserId = user.Id;
            }

            _context.Entry(user).State = EntityState.Modified;
        }
Пример #4
0
        public void AddUser(User user)
        {
            if (user == null)
            {
                throw new ArgumentNullException(nameof(user));
            }

            foreach (var smartLockUser in user.SmartLockUsers)
            {
                smartLockUser.UserId = user.Id;
            }

            _context.Users.Add(user);
        }