public List <string> GetAll(Person personHavingRelatives) { var sistersOfSpouse = new Sister().GetAll(personHavingRelatives?.Spouse)?.Select(sister => sister?.Name).ToList(); var WivesOfBrother = new Brother().GetAll(personHavingRelatives)?.Where(brother => brother?.Spouse != null).Select(brother => brother?.Spouse?.Name).ToList(); var sisterInLaws = new List <string>(); if (sistersOfSpouse != null && sistersOfSpouse.Count > 0) { sisterInLaws.AddRange(sistersOfSpouse); } if (WivesOfBrother != null && WivesOfBrother.Count > 0) { sisterInLaws.AddRange(WivesOfBrother); } return(sisterInLaws); }
public List <string> GetAll(Person personHavingRelatives) { var brothersOfSpouse = new Brother().GetAll(personHavingRelatives?.Spouse)?.Select(brother => brother?.Name).ToList(); var husbandsOfSisters = new Sister().GetAll(personHavingRelatives)?.Where(sister => sister?.Spouse != null).Select(sister => sister?.Spouse?.Name).ToList(); var brotherInLaws = new List <string>(); if (brothersOfSpouse != null && brothersOfSpouse.Count > 0) { brotherInLaws.AddRange(brothersOfSpouse); } if (husbandsOfSisters != null && husbandsOfSisters.Count > 0) { brotherInLaws.AddRange(husbandsOfSisters); } return(brotherInLaws); }