Exemplo n.º 1
0
 public IEnumerable <EndpointPart> GetAssociatedEndpoints(EntityDefinitionPart entity)
 {
     return(_contentManager
            .Query <EndpointPart, EndpointPartRecord>(VersionOptions.Latest)
            .Where(record => record.SelectedEntityId == entity.Id.SerializeId())
            .List());
 }
Exemplo n.º 2
0
        public EntityDefinition ToViewModel(EntityDefinitionPart part)
        {
            var tokenState = new Dictionary <string, object> {
                { "Content", part.ContentItem }
            };

            var viewModel = new EntityDefinition()
            {
                Title       = part.As <TitlePart>().Title,
                ApiName     = part.ApiName,
                Description = _tokenizer.Replace(part.As <BodyPart>().Text, tokenState),
                Fields      = part.GetContentPicker("FieldDefinitions")
                              .GetPickedContentAs <EntityFieldPart>()
                              .Select(ToViewModel),
                AssociatedEndpoints = GetAssociatedEndpoints(part).Select(ToViewModel)
            };

            return(viewModel);
        }