private PortCallOverview GetOverview(int portCallId) { List <Organization> orgList = _context.Organization.Where(o => o.OrganizationTypeId == Constants.Integers.DatabaseTableIds.ORGANIZATION_TYPE_GOVERNMENT_AGENCY).ToList(); var portCall = _context.PortCall.Where(pc => pc.PortCallId == portCallId) .Include(pc => pc.Ship.ShipType) .Include(pc => pc.Ship.ShipFlagCode.Country) .Include(pc => pc.Ship.ShipContact) .Include(pc => pc.Ship.ShipStatus) .Include(pc => pc.Location.Country) .Include(pc => pc.Location.LocationType) .Include(pc => pc.OrganizationPortCall) .Include(pc => pc.PortCallStatus).FirstOrDefault(); PortCallOverview overview = new PortCallOverview(); overview.PortCall = portCall; overview.Ship = portCall.Ship; overview.Location = portCall.Location; overview.Status = portCall.PortCallStatus.Name; overview.ClearanceList = (from opc in portCall.OrganizationPortCall join o in orgList on opc.OrganizationId equals o.OrganizationId select opc).ToList(); return(overview); }
private PortCallOverview GetOverview(int portCallId) { List <Organization> orgList = _context.Organization.Where(o => o.OrganizationTypeId == Constants.Integers.DatabaseTableIds.ORGANIZATION_TYPE_GOVERNMENT_AGENCY).ToList(); var portCall = _context.PortCall.Where(pc => pc.PortCallId == portCallId) .Include(pc => pc.Ship.ShipType) .Include(pc => pc.Ship.ShipFlagCode.Country) .Include(pc => pc.Ship.ShipContact) .Include(pc => pc.Ship.ShipStatus) .Include(pc => pc.Location.Country) .Include(pc => pc.Location.LocationType) .Include(pc => pc.PortCallDetails) .Include(pc => pc.FalShipStores).ThenInclude(fss => fss.MeasurementType) //.Include(pc => pc.PersonOnBoard) .Include(pc => pc.PreviousLocation) .Include(pc => pc.NextLocation) .Include(pc => pc.PreviousLocation.Country) .Include(pc => pc.NextLocation.Country) .Include(pc => pc.OrganizationPortCall).ThenInclude(opc => opc.ClearedByUser) .Include(pc => pc.PortCallStatus) .Include(pc => pc.User).ThenInclude(u => u.Person) .Include(pc => pc.User).ThenInclude(u => u.Organization) .FirstOrDefault(); PortCallOverview overview = new PortCallOverview(); overview.PortCall = portCall; overview.Ship = portCall.Ship; overview.Location = portCall.Location; overview.Status = portCall.PortCallStatus.Name; overview.ClearanceList = (from opc in portCall.OrganizationPortCall join o in orgList on opc.OrganizationId equals o.OrganizationId select opc).ToList(); return(overview); }