public StregsystemCommandParser(Stregsystem stregsystem, IStregsystemUI ui) { this.stregsystem = stregsystem; this.ui = ui; MakeTempUsers(); adminFunctions = new Dictionary <string, Action <string> >(); adminFunctions.Add(":q", str => ui.Close()); adminFunctions.Add(":quit", str => ui.Close()); adminFunctions.Add(":activate", productID => stregsystem.GetProduct(Convert.ToInt32(productID)).Active = true); adminFunctions.Add(":deactivate", productID => stregsystem.GetProduct(Convert.ToInt32(productID)).Active = false); adminFunctions.Add(":crediton", productID => stregsystem.GetProduct(Convert.ToInt32(productID)).CanBeBoughtOnCredit = true); adminFunctions.Add(":creditoff", productID => stregsystem.GetProduct(Convert.ToInt32(productID)).CanBeBoughtOnCredit = false); adminFunctions.Add(":addcredits", usernameAndAmount => stregsystem.AddCreditsToAccount(Convert.ToInt32(usernameAndAmount.Split()[1]), usernameAndAmount.Split()[0])); adminFunctions.Add(":makeuser", userDetails => MakeUser(userDetails)); adminFunctions.Add(":help", str => adminFunctions.Keys.ToList().ForEach(key => ui.DisplayMessage(key))); }