Exemplo n.º 1
0
        public async Task <IViewComponentResult> InvokeAsync(string entityType, string entityId, bool displaySubmitButton = true)
        {
            var viewModel = new ContentViewModel(entityType, entityId);

            try
            {
                if (entityId != null)
                {
                    var content = await contentAdminAppService.GetAsync(entityType, entityId);

                    viewModel.Value = content.Value;
                    viewModel.Id    = content.Id;
                }
            }
            catch (EntityNotFoundException)
            {
                // Initialize editor even content doesn't exist.
            }

            return(View(
                       "~/Pages/CmsKit/Contents/Components/EntityContentEditor/Default.cshtml",
                       new EntityContentEditorViewModel(viewModel, displaySubmitButton)));
        }
Exemplo n.º 2
0
 public EntityContentEditorViewModel(ContentViewModel viewModel, bool displaySubmitButton)
 {
     ViewModel           = viewModel;
     DisplaySubmitButton = displaySubmitButton;
 }