Esempio n. 1
0
 public Comment(User author, string text)
 {
     this.Author = author;
     this.Text = text;
 }
Esempio n. 2
0
        /// <summary>
        /// Register new User in Issue Tracker System
        /// </summary>
        /// <param name="username">User usernsme</param>
        /// <param name="password">User password</param>
        /// <param name="confirmPassword">User confirmed password</param>
        /// <returns>Return different message with result of the registration. Success or Not</returns>
        public string RegisterUser(string username, string password, string confirmPassword)
        {
            if (this.Data.CurrentUser != null)
            {
                return string.Format("There is already a logged in user");
            }

            if (password != confirmPassword)
            {
                return string.Format("The provided passwords do not match", username);
            }

            if (this.Data.Users.ContainsKey(username))
            {
                return string.Format("A user with username {0} already exists", username);
            }

            var user = new User(username, password);
            this.Data.Users.Add(username, user);

            string result = string.Format("User {0} registered successfully", username);
            return result;
        }