Created
January 28, 2016 10:17
-
-
Save Jonne/f14a320e446f1c068501 to your computer and use it in GitHub Desktop.
Maybe in tranformations
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
private IEnumerable<ProductAdvisorStep> MapSteps(ChildList children) | |
{ | |
return children.SelectMany(GetStep); | |
} | |
private Maybe<ProductAdvisorStep> GetStep(Item item, int index) | |
{ | |
string facetName = | |
Context.Database.GetItem(item.Fields[ProductAdvisorDataFields.StepFacetField]?.Value)?.Name; | |
if (string.IsNullOrEmpty(facetName)) | |
{ | |
logger.Error("A Facet is required for a ProductAdvisorStep."); | |
return Maybe.Empty<ProductAdvisorStep>(); | |
} | |
return new ProductAdvisorStep | |
{ | |
Key = index + 1, | |
Title = item.Fields[ProductAdvisorDataFields.StepQuestionField].Value, | |
Facet = facetName | |
}.ToMaybe(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment