Beispiel #1
0
        public void UpdateUser(UserDTO userDTO)
        {
            User user = new User();

            UserConvertor.ConvertToUserEntity(ref user, userDTO, true);
            unitOfWork.UserRepository.Update(user);
        }
Beispiel #2
0
        public void AddUser(UserDTO userDTO)
        {
            User user = new User();

            UserConvertor.ConvertToUserEntity(ref user, userDTO, false);
            user.Password = EncryptionHelper.Encryptword(userDTO.Password);
            unitOfWork.UserRepository.Add(user);
        }
Beispiel #3
0
        public UserDTO GetUserById(int userId)
        {
            UserDTO userDTO = null;
            var     user    = unitOfWork.UserRepository.GetById(userId);

            if (user != null)
            {
                userDTO = UserConvertor.ConvertToUserDto(user);
            }
            return(userDTO);
        }
Beispiel #4
0
        public List <UserDTO> GetAllUsers()
        {
            List <UserDTO> userList = new List <UserDTO>();
            var            users    = unitOfWork.UserRepository.GetAll();

            if (users != null)
            {
                foreach (var user in users)
                {
                    userList.Add(UserConvertor.ConvertToUserDto(user));
                }
            }

            return(userList);
        }