Esempio n. 1
0
    /// <summary>
    /// Creates asset.
    /// </summary>
    /// <param name="client"></param>
    /// <param name="fileContent">Represents the content of the file.</param>
    /// <param name="assetCreateModel">Updated values for the strongly typed asset.</param>
    public async static Task <AssetModel <T> > CreateAssetAsync <T>(this IManagementClient client, FileContentSource fileContent, AssetCreateModel <T> assetCreateModel) where T : new()
    {
        if (fileContent == null)
        {
            throw new ArgumentNullException(nameof(fileContent));
        }
        if (assetCreateModel == null)
        {
            throw new ArgumentNullException(nameof(assetCreateModel));
        }

        var fileResult = await client.UploadFileAsync(fileContent);

        assetCreateModel.FileReference = fileResult;

        var response = await client.CreateAssetAsync(assetCreateModel);

        return(response);
    }