source/OptimaJet.DWKit.StarterApplication/Services/ProductService.cs
/// <summary>
/// Get the most recent published file of specified type associated with this product
/// </summary>
/// <param name="id">Product ID</param>
/// <param name="type">ProductArtifact type to be returned</param>
/// <returns></returns>
Get the most recent published file of specified type associated with this product
Get the most recent published file of specified type associated with this product
public async Task<ProductArtifact> GetPublishedFile(Guid id, String type)
        {
            var publications = await ProductPublicationsRepository.Get()
                .Where(pp => pp.ProductId == id && pp.Success == true)
                .Include(pp => pp.ProductBuild)
                    .ThenInclude(pb => pb.ProductArtifacts)
                .OrderByDescending(p => p.Id)
                .ToListAsync();
            foreach(var publication in publications)
            {
                if (publication == null || publication.ProductBuild.ProductArtifacts == null)
                {
                    continue;
                }
                var artifact = publication.ProductBuild.ProductArtifacts
                    .Where(pa => pa.ArtifactType == type)
                    .FirstOrDefault();
                if (artifact != null)
                {
                    return artifact;
                }
            }
            return null;
        }
public async Task < ProductArtifact > GetPublishedFile ( Guid id , String type ) { var publications = await ProductPublicationsRepository . Get ( ) . Where ( pp => pp . ProductId == id && pp . Success == true ) . Include ( pp => pp . ProductBuild ) . ThenInclude ( pb => pb . ProductArtifacts ) . OrderByDescending ( p => p . Id ) . ToListAsync ( ) ; foreach ( var publication in publications ) { if ( publication == null || publication . ProductBuild . ProductArtifacts == null ) { continue ; } var artifact = publication . ProductBuild . ProductArtifacts . Where ( pa => pa . ArtifactType == type ) . FirstOrDefault ( ) ; if ( artifact != null ) { return artifact ; } } return null ; }
Get the most recent published file of specified type associated with this product
Get the most recent published file of specified type associated with this product
// Return null if product has not been successfully published
None
id
Guid
None
type
String
ProductArtifact type to be returned
ProductArtifact type to be returned