public ICustomEntityTemplateSectionTagBuilder <TModel> Create <TModel>( HtmlHelper htmlHelper, ICustomEntityDetailsPageViewModel <TModel> customEntityViewModel, string sectionName ) where TModel : ICustomEntityDetailsDisplayViewModel { return(new CustomEntityTemplateSectionTagBuilder <TModel>(_moduleRenderer, _moduleDataModelTypeFactory, _moduleTypeFileNameFormatter, htmlHelper, customEntityViewModel, sectionName)); }
public CustomEntityTemplateSectionTagBuilder( IPageModuleRenderer moduleRenderer, IPageModuleDataModelTypeFactory moduleDataModelTypeFactory, IPageModuleTypeFileNameFormatter moduleTypeFileNameFormatter, HtmlHelper htmlHelper, ICustomEntityDetailsPageViewModel <TModel> customEntityViewModel, string sectionName) { Condition.Requires(sectionName).IsNotNullOrWhiteSpace(); Condition.Requires(customEntityViewModel).IsNotNull(); _moduleRenderer = moduleRenderer; _moduleDataModelTypeFactory = moduleDataModelTypeFactory; _moduleTypeFileNameFormatter = moduleTypeFileNameFormatter; _sectionName = sectionName; _customEntityViewModel = customEntityViewModel; _htmlHelper = htmlHelper; }
/// <summary> /// Maps data to an empty view model for a custom entity details page. /// </summary> /// <param name="displayModelType">The type information of the display model to apply to the generic view model.</param> /// <param name="viewModel">The view model to map data to.</param> /// <param name="mappingParameters">The data passed through to map to the view model.</param> public virtual void MapCustomEntityViewModel <TDisplayModel>( ICustomEntityDetailsPageViewModel <TDisplayModel> viewModel, CustomEntityDetailsPageViewModelBuilderParameters mappingParameters ) where TDisplayModel : ICustomEntityDetailsDisplayViewModel { Map(viewModel, mappingParameters); Condition.Requires(mappingParameters.CustomEntityModel).IsNotNull(); var customEntityRenderDetails = mappingParameters.CustomEntityModel; var customModel = new CustomEntityRenderDetailsViewModel <TDisplayModel>(); customModel.CustomEntityId = customEntityRenderDetails.CustomEntityId; customModel.CustomEntityVersionId = customEntityRenderDetails.CustomEntityVersionId; customModel.Locale = customEntityRenderDetails.Locale; customModel.Sections = customEntityRenderDetails.Sections; customModel.Title = customEntityRenderDetails.Title; customModel.UrlSlug = customEntityRenderDetails.UrlSlug; customModel.WorkFlowStatus = customEntityRenderDetails.WorkFlowStatus; customModel.Model = _customEntityDisplayModelMapper.MapDetails <TDisplayModel>(customEntityRenderDetails); viewModel.CustomEntity = customModel; }