public Task <List <CargoResource> > GetCargosAsync(Guid containerIdentity, CargoParams queryParams) => Collection .Find(c => c.Identity == containerIdentity) .Project(c => c.Cargos .Page(queryParams) .OrderByDescending(queryParams.OrderByExpression.Compile()) .Select(ca => ca.ToCargoResource()) .ToList()) .SingleOrDefaultAsync();
public Task <List <CargoResource> > GetCargosOfLoadedContainerAsync (Guid supplierIdentity, Guid containerIdentity, CargoParams queryParams) => Collection .Find(s => s.Identity == supplierIdentity) .Project(s => s.LoadedContainers .Where(c => c.Identity == containerIdentity) .SelectMany(c => c.Cargos) .Page(queryParams) .OrderByDescending(queryParams.OrderByExpression.Compile()) .Select(ca => ca.ToCargoResource()) .ToList()) .SingleOrDefaultAsync();
public Task <List <CargoResource> > GetCargosAsync (Guid inventoryIdentity, Guid containerIdentity, CargoParams queryParams) => Collection .Find(i => i.Identity == inventoryIdentity) .Project(i => i.AcceptedContainers .Where(c => c.Identity == containerIdentity) .SelectMany(c => c.Cargos) .Page(queryParams) .OrderByDescending(queryParams.OrderByExpression.Compile()) .Select(c => c.ToCargoResource()) .ToList()) .SingleOrDefaultAsync();
public async Task <ActionResult <List <CargoResource> > > GetCargosOfPackedContainer( Guid shipmentIdentity, Guid containerIdentity, [FromQuery] CargoParams queryParams, [FromServices] ShipmentQuery shipmentQuery) { List <CargoResource> cargos = await shipmentQuery .GetCargosOfPackedContainerAsync(shipmentIdentity, containerIdentity, queryParams); if (cargos is null) { return(NotFound()); } return(cargos); }