public List <Instrument> InstrumentSelectForTechnical(Selection s) { string caseTechnical = s.PreferredTechnical; foreach (Instrument i in instrumentRepo.GetInstrumentsByTechnical(caseTechnical)) { bool add = true; foreach (Instrument j in technicalInstruments) { if (i.DescriptionText.Equals(j.DescriptionText)) { add = false; break; } } if (add) { technicalInstruments.Add(i); } } /* * List<Instrument> technicalInstrument1 = new List<Instrument>(); * // Switch * switch (caseTechnical) * { * case "0": * technicalInstrument1 = instrumentRepo.GetInstrumentsByTechnical("0"); * break; * case "1": * technicalInstrument1 = instrumentRepo.GetInstrumentsByTechnical("1"); * break; * case "2": * technicalInstrument1 = instrumentRepo.GetInstrumentsByTechnical("2"); * break; * case "3": * technicalInstrument1 = instrumentRepo.GetInstrumentsByTechnical("3"); * break; * } * foreach (Instrument instrument in technicalInstrument1) * { * if (!technicalInstruments.Contains(instrument)) * { * technicalInstruments.Add(instrument); * } * } */ return(technicalInstruments); }