/// <summary> /// Private method to create a content object from a DocumentDto, which is used by Get and GetByVersion. /// </summary> /// <param name="dto"></param> /// <param name="versionId"></param> /// <returns></returns> private IContent CreateContentFromDto(DocumentDto dto, Guid versionId) { var contentType = _contentTypeRepository.Get(dto.ContentVersionDto.ContentDto.ContentTypeId); var factory = new ContentFactory(contentType, NodeObjectTypeId, dto.NodeId); var content = factory.BuildEntity(dto); //Check if template id is set on DocumentDto, and get ITemplate if it is. if (dto.TemplateId.HasValue && dto.TemplateId.Value > 0) { content.Template = _templateRepository.Get(dto.TemplateId.Value); } content.Properties = GetPropertyCollection(dto.NodeId, versionId, contentType, content.CreateDate, content.UpdateDate); ((ICanBeDirty)content).ResetDirtyProperties(); return(content); }
/// <summary> /// Private method to create a content object from a DocumentDto, which is used by Get and GetByVersion. /// </summary> /// <param name="dto"></param> /// <param name="versionId"></param> /// <returns></returns> private IContent CreateContentFromDto(DocumentDto dto, Guid versionId) { var contentType = _contentTypeRepository.Get(dto.ContentVersionDto.ContentDto.ContentTypeId); var factory = new ContentFactory(contentType, NodeObjectTypeId, dto.NodeId); var content = factory.BuildEntity(dto); //Check if template id is set on DocumentDto, and get ITemplate if it is. if (dto.TemplateId.HasValue && dto.TemplateId.Value > 0) { content.Template = _templateRepository.Get(dto.TemplateId.Value); } content.Properties = GetPropertyCollection(dto.NodeId, versionId, contentType, content.CreateDate, content.UpdateDate); //on initial construction we don't want to have dirty properties tracked // http://issues.umbraco.org/issue/U4-1946 ((Entity)content).ResetDirtyProperties(false); return(content); }
public IList <ContentType> GetContentTypeList() { IContentTypeRepository contentTypeRepository = _dataFactoryRepository.GetDataRepository <IContentTypeRepository>(); return(contentTypeRepository.Get().ToList()); }