public void HandleUserInput(List <string> commandInputs) { if ((commandInputs.Count == 1) || (Regex.IsMatch(commandInputs[1], @"^[1-9 ]\d*$"))) { switch (commandInputs.Count) { case 1: { User user = null; try { user = _stregsystem.GetUserByUsername(commandInputs[0]); } catch (UserNotFoundException) { _stregystemui.DisplayUserNotFound(commandInputs[0]); return; } _stregystemui.DisplayUserInfo(user); _stregystemui.DisplayPastTransactions(user); break; } case 2: { HandlePurchase(commandInputs[0], int.Parse(commandInputs[1]), 1); break; } case 3: { HandlePurchase(commandInputs[0], int.Parse(commandInputs[1]), int.Parse(commandInputs[2])); break; } default: { _stregystemui.DisplayGeneralError("Der skete en fejl, tjek om syntax er korrekt."); break; } } } else { _stregystemui.DisplayuProductNotFound(commandInputs[1]); return; } }