Example #1
0
        /// <summary>
        /// 转到新建单页节点页面
        /// </summary>
        /// <returns></returns>
        public ActionResult AddSingle()
        {
            ViewBag.SingleTitle = "新建单页节点";
            var model = new SingleColumnDto();

            return(View(model));
        }
Example #2
0
        public async Task <JsonResult> AddOrUpdateSingle(SingleColumnDto model)
        {
            await _columnAppService.AddOrUpdateSingleAsync(model);

            return(Json(new AjaxResponse {
                TargetUrl = "Index"
            }));
        }
Example #3
0
        /// <summary>
        /// 添加或修改单页
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public async Task AddOrUpdateSingleAsync(SingleColumnDto model)
        {
            //拿到网站配置
            var siteOption =
                await _cacheManager.GetCache <string, SiteOptionDto>(EasyFastConsts.TemplateCacheKey)
                .GetAsync("siteOptionCache", () => _siteConfigAppService.GetSiteOption());

            if (string.IsNullOrWhiteSpace(model.IndexHtmlRule))
            {
                model.IndexHtmlRule = $"{model.Dir}index.html";
            }

            if (model.IsIndexHtml && !string.IsNullOrWhiteSpace(siteOption.HTMLDir) && !model.IndexHtmlRule.Contains(siteOption.HTMLDir))
            {
                model.IndexHtmlRule = siteOption.HTMLDir + model.IndexHtmlRule;
            }
            await _columnRepository.InsertOrUpdateAsync(model.MapTo <Core.Entities.Column>());
        }