Example #1
0
        public string EngageMachine(string selectedPilotName, string selectedMachineName)
        {
            if (!PilotsList.Exists(x => x.Name == selectedPilotName))
            {
                return(String.Format(OutputMessages.PilotNotFound, selectedPilotName));
            }
            if (!MachineList.Exists(x => x.Name == selectedMachineName))
            {
                return(String.Format(OutputMessages.MachineNotFound, selectedMachineName));
            }
            var index = MachineList.FindIndex(x => x.Name == selectedMachineName);

            if (machineList[index].Pilot != null)
            {
                return(String.Format(OutputMessages.MachineHasPilotAlready, selectedMachineName));
            }
            else
            {
                var indexPilot = PilotsList.FindIndex(x => x.Name == selectedPilotName);
                machineList[index].Pilot = PilotsList[indexPilot];
                return(String.Format(OutputMessages.MachineEngaged, selectedPilotName, selectedMachineName));
            }
        }
Example #2
0
        public string PilotReport(string pilotReporting)
        {
            var index = PilotsList.FindIndex(x => x.Name == pilotReporting);

            return(PilotsList[index].Report());
        }