/// <hireDealer> /// This method takes from the console information for a new dealer. /// (first name, last name, nickname, city) /// It adds the new dealer to the database. /// </hireDealer> public void HireDealer() { string firstName; string lastName; string nickname; string city; double money = 0; try { Dictionary <string, string> dict = CommandReader.HireDealer(); firstName = dict["firstName"]; lastName = dict["lastName"]; nickname = dict["nickname"]; city = dict["city"]; if (firstName == "" || lastName == "" || nickname == "" || city == "") { throw new InvalidOperationException(ConstantStrings.Blank); } OutputPrinter.Connecting(); List <string> nicknames = c.Dealers.Select(e => e.Nickname).ToList(); if (nicknames.Contains(nickname)) { throw new InvalidOperationException(ConstantStrings.Dealer + $" with nickname '{nickname}' " + ConstantStrings.AlreadyExists); } var dealer = new Dealer() { First_Name = firstName, Last_Name = lastName, Nickname = nickname, CityFrom = city, Money_Brought_This_Month = money }; Hire(dealer); OutputPrinter.Done(); } catch (Exception e) { Console.WriteLine(e.Message); OutputPrinter.InvalidCommand(); } }