public string Check(List <string> arguments) { string checkThisId = arguments[0]; Unit unit = (Unit)Harvesters.FirstOrDefault(h => h.Id == checkThisId) ?? Providers.FirstOrDefault(p => p.Id == checkThisId); if (unit != null) { return(unit.ToString()); } //return $"No element found with id - {checkThisId}"; return(string.Format(Messages.UnitNotFound, checkThisId)); }
public string Check(List <string> arguments) { var id = arguments[0]; var harvester = Harvesters.FirstOrDefault(h => h.Id == id); var provider = Providers.FirstOrDefault(p => p.Id == id); if (harvester != null) { return(harvester.ToString()); } else if (provider != null) { return(provider.ToString()); } return($"No element found with id - {id}"); }