Ejemplo n.º 1
0
        public async Task <IActionResult> Get(Guid id)
        {
            var text = await Task.Run(() => _textFacade.GetContent(id));

            if (text == null)
            {
                return(NotFound());
            }
            return(Ok(text));
        }
Ejemplo n.º 2
0
        public async Task <IViewComponentResult> InvokeAsync(ModuleModel model)
        {
            var content = _textModuleFacade.GetContent(model.Id, _contextService.GetCurrentLanguageInfo().Id);

            if (content == null)
            {
                var defaultContent = "Your content here...";

                await Task.Run(() => _commandSender.Send <CreateTextModule, TextModule>(new CreateTextModule
                {
                    SiteId   = SiteId,
                    Id       = Guid.NewGuid(),
                    ModuleId = model.Id,
                    Content  = defaultContent
                }));

                content = defaultContent;
            }

            return(View("Default", content));
        }