/// <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> 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 if product has not been successfully published return(null); }
public async Task <ProductArtifact> GetPublishedAppDetails(String package) { var publications = await ProductPublicationsRepository.Get() .Where(pp => pp.Package == package && 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 == "play-listing-manifest") .FirstOrDefault(); if (artifact != null) { return(artifact); } } return(null); }