FundraisingMenu.SearchServices.FundraisingMenuSearchServices.AddVirtualProjects C# (CSharp) Method

AddVirtualProjects() private method

Add "virtual" projects for any packages that don't have any associated projects. The search capability is data driven by *projects* and all package information is derived from projects. Therefore to show a package with no associated projects, we need to add at least one project record that corresponds to each package. This function accomplishes that. This is an ugly solution to the problem, but I considered many alternatives and they were all uglier or required a huge rework of how the page works. Since we're not sure exactly how this is all going to shake out anyway, this seemed like the most cost-effective solution for now.
private AddVirtualProjects ( List list ) : void
list List
return void
        private void AddVirtualProjects(List<FundraisingMenuResult> list)
        {
            List<Package> noProjects = _packages.GetPackagesWithoutProjects();
            foreach (Package package in noProjects)
            {
                FundraisingMenuResult result = FundraisingMenuResult.DefaultInstance();
                result.ProjectPackage.Add(GetProjectPackageDto(0, package, false));
                list.Add(result);
            }
        }