public List <BE.HostingUnit> GetHostingUnits(Func <BE.HostingUnit, bool> predicate = null) { List <BE.HostingUnit> list = null; if (predicate != null) { list = HostingUnitsList.Where(predicate).ToList(); } else { list = HostingUnitsList; } for (int i = 0; i < list.Count(); i++) { list[i].Images = GalleryList.Where(c => c.HostingUnitId == list[i].stSerialKey).ToList(); } for (int i = 0; i < list.Count(); i++) { list[i].Days = DaysList.Where(c => c.HostingUnitId == list[i].stSerialKey).ToList(); } return(list); }
public HostingUnit GetHostingUnitById(int stSerialKey) { var hosting = HostingUnitsList.FirstOrDefault(c => c.stSerialKey == stSerialKey); if (hosting != null) { hosting.Images = GalleryList.Where(c => c.HostingUnitId == hosting.stSerialKey).ToList(); } return(hosting); }