public string GetBerlinClock(BerlinClockInputModel input) { BerlinClockInputModelValidator clockValidator = new BerlinClockInputModelValidator(); clockValidator.ValidateAndThrow(input); // Hours var hourDictionary = GetLampState(input.hour); int firstRowQuant = hourDictionary["first"]; int secondRowQuant = hourDictionary["second"]; // Minutes var minDictionary = GetLampState(input.minute); int thirdRowQuant = minDictionary["first"]; int fourthRowQuant = minDictionary["second"]; // Lamps symbols string second = GetSecLampState(input.second).ToString(); string firstRow = RowConverter(firstRowQuant, 4, LampEnum.Red); string secondRow = RowConverter(secondRowQuant, 4, LampEnum.Red); string thirdRow = RowConverter(thirdRowQuant, 11, LampEnum.Yellow, LampEnum.Red); string fourthRow = RowConverter(fourthRowQuant, 4, LampEnum.Yellow); BerlinClockModel berlinClock = new BerlinClockModel { second = second, firstRow = firstRow, secondRow = secondRow, thirdRow = thirdRow, fourthRow = fourthRow }; return(ConcatClockCode(berlinClock)); }
public string convertTime(string aTime) { string[] timeSplit = aTime.Split(':'); var berlinClockInputModel = new BerlinClockInputModel { hour = Convert.ToInt32(timeSplit[0]), minute = Convert.ToInt32(timeSplit[1]), second = Convert.ToInt32(timeSplit[2]) }; var clock = berlinClockService.GetBerlinClock(berlinClockInputModel); return(clock); }