Exemplo n.º 1
0
        /// <summary>
        /// Add a new user. If the user has already
        /// been added, an exception is thrown.
        /// </summary>
        /// <param name="userName">
        /// User name for new user.
        /// </param>
        /// <param name="password">
        /// Password for new user.
        /// </param>
        /// <param name="userType">
        /// User type for new user.
        /// </param>
        public void AddUser(string userName, string password, string userType)
        {
            if (Users.ContainsKey(userName))
            {
                throw new ArgumentException(nameof(AddUser));
            }

            Users.Add(userName, new User(userName, password, userType));
            _userTypes.AddUserType(userType);
        }