Skip to content

Instantly share code, notes, and snippets.

@dcomartin
Created June 19, 2024 22:42
Show Gist options
  • Save dcomartin/0d70c9484cbd35c6839d797a81d2b195 to your computer and use it in GitHub Desktop.
Save dcomartin/0d70c9484cbd35c6839d797a81d2b195 to your computer and use it in GitHub Desktop.
public static class Extensions
{
public static bool IsDownloadable(this OfferingType offeringType)
{
var validOfferings = new List<OfferingType>()
{
OfferingType.Template,
OfferingType.Ebook,
OfferingType.OfflineCourse
};
return validOfferings.Contains(offeringType);
}
}
public sealed class ProductHandler(ResourcesHelper resourcesHelper)
{
public void DoStuff(Product product)
{
if (product.Type.IsDownloadable())
{
var fileName = resourcesHelper.GetDefaultDownloadFileName(product.Type);
var downloadUrl = resourcesHelper.GetDownloadUrl(product.Type);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment