-
-
Save dcomartin/d4b455674bce7d6d7ad9e16f007b31b1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public enum OfferingType | |
{ | |
Course, | |
Ebook, | |
Book, | |
Template, | |
OfflineCourse, | |
} | |
public sealed record Product(int Id, OfferingType Type); | |
public sealed class ProductHandler(ResourcesHelper _resourcesHelper) | |
{ | |
public void DoStuff(Product product) | |
{ | |
if (product.Type == OfferingType.Template || | |
product.Type == OfferingType.Ebook || | |
product.Type == OfferingType.OfflineCourse) | |
{ | |
var fileName = _resourcesHelper.GetDefaultDownloadFileName(product.Type); | |
var downloadUrl = _resourcesHelper.GetDownloadUrl(product.Type); | |
} | |
} | |
} | |
public sealed class ResourcesHelper | |
{ | |
public string? GetDownloadUrl(OfferingType offeringType) | |
{ | |
if (offeringType == OfferingType.Template || | |
offeringType == OfferingType.Ebook || | |
offeringType == OfferingType.OfflineCourse) | |
{ | |
// some code to do this... | |
return "TODO: get the download URL"; | |
} | |
return null; | |
} | |
public string? GetDefaultDownloadFileName(OfferingType offeringType) | |
{ | |
if (offeringType == OfferingType.Template || | |
offeringType == OfferingType.Ebook || | |
offeringType == OfferingType.OfflineCourse) | |
{ | |
// some code to do this... | |
return "TODO: get the file name"; | |
} | |
return null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment