public override Task <ModuleViewComponentResult> OnViewComponentLoad() { SettingsModel model = new SettingsModel(this); model.PageId = Page.PageId; HtmlContentInfo htmlContent = _htmlBusiness.GetHtmlContent(Module.ModuleId); if (Request.Method == "POST") { string userId = _userManager.GetUserId(HttpContext.User); if (htmlContent == null) { htmlContent = new HtmlContentInfo(); htmlContent.ModuleId = Module.ModuleId; htmlContent.CreatedAt = DateTime.UtcNow; htmlContent.CreatedBy = userId; } htmlContent.Content = model.Content; htmlContent.UpdatedAt = DateTime.UtcNow; htmlContent.UpdatedBy = userId; _htmlBusiness.SaveHtmlContent(htmlContent); } else { model.Content = htmlContent?.Content; } return(Task.FromResult(ModuleView("Settings", model))); }
public override Task <ModuleViewComponentResult> OnViewComponentLoad() { HtmlModel model = new HtmlModel(this); model.Content = _htmlBusiness.GetHtmlContent(Module.ModuleId)?.Content; return(Task.FromResult(ModuleView("Index", model))); }