diff --git a/MCTG/MCTGApp/Program.cs b/MCTG/MCTGApp/Program.cs index 7eeac9b..41aa1f4 100644 --- a/MCTG/MCTGApp/Program.cs +++ b/MCTG/MCTGApp/Program.cs @@ -13,7 +13,7 @@ foreach (User user in users) try { Console.WriteLine(user.Name); - Console.WriteLine(user.Priorities.ToString()); + Console.WriteLine(user.Priorities[0].ToString()); } catch (ArgumentNullException erreurNomVide) { Console.WriteLine(erreurNomVide.Message); diff --git a/MCTG/MCTGLib/Priority.cs b/MCTG/MCTGLib/Priority.cs index f043f34..8382723 100644 --- a/MCTG/MCTGLib/Priority.cs +++ b/MCTG/MCTGLib/Priority.cs @@ -12,6 +12,8 @@ namespace MCTGLib /// public enum Priority { Economic, Fast, Easy, Light, Gourmet }; + + } diff --git a/MCTG/MCTGLib/User.cs b/MCTG/MCTGLib/User.cs index 72f4511..dce3d83 100644 --- a/MCTG/MCTGLib/User.cs +++ b/MCTG/MCTGLib/User.cs @@ -15,9 +15,9 @@ namespace MCTGLib { #region Private Attributes - private string Name; - private string Surname; - private string Mail; + private string name; + private string surname; + private string mail; #endregion @@ -45,16 +45,35 @@ namespace MCTGLib /// Property to get Name of users, without setter because we don't want users /// to change their Name. /// - public string UserName + public string Name { - get { return Name; } + get { return name; } + private set + { + if (string.IsNullOrWhiteSpace(value)) + { + throw new ArgumentNullException(); + } + name = value; + } } + public string Surname + { + get { return surname; } + private set { surname = value; } + } + public string Mail + { + get { return mail; } + private set { mail = value; } + } + private List priorities; public List Priorities { - get; - set; + get => priorities; + set=> priorities = value; } @@ -71,12 +90,12 @@ namespace MCTGLib Name = name; Surname = surname; Mail = mail; - Priorities = new List { - Priority.Gourmet, - Priority.Economic, - Priority.Fast, - Priority.Light, - Priority.Easy}; + priorities = new List { + Priority.Gourmet, + Priority.Economic, + Priority.Fast, + Priority.Light, + Priority.Easy}; ProfilPict = picture; }