public static List <InsuranceType> GetForPolicy() { List <Deal> dealList = Deal.GetActiveDeals(); List <InsuranceType> insuranceTypeList = new List <InsuranceType>(); List <Brokerage> bList = new List <Brokerage>(); foreach (Deal d in dealList) { foreach (Brokerage b in d.Brokerages) { if (b.IsActive) { bList.Add(b); } } //bList.AddRange(d.Brokerages.ToList()); } foreach (Brokerage b in bList) { if (!insuranceTypeList.Contains(b.InsuranceSubType.InsuranceType)) { insuranceTypeList.Add(b.InsuranceSubType.InsuranceType); } } return(insuranceTypeList); }
public static List <InsuranceCompany> GetByActiveDeals() { List <Deal> dealsList = Deal.GetActiveDeals(); List <InsuranceCompany> companiesList = new List <InsuranceCompany>(); foreach (Deal d in dealsList) { if (!companiesList.Contains(d.InsuranceCompany) && d.InsuranceCompany.IsActive) { companiesList.Add(d.InsuranceCompany); } } return(companiesList.OrderBy(c => c.Code).ToList()); }