public async Task <JsonResult> SaveWatermark(SeoEditDto editDto) { CheckModelState(); bool status = false; string message = ""; try { var oldModel = await _seoAppService.GetDefaultSeoAsync(); if (oldModel != null) { editDto.SiteTitle = oldModel.SiteTitle; editDto.SiteKeywords = oldModel.SiteKeywords; editDto.SiteDescription = oldModel.SiteDescription; } await _seoAppService.CreateOrUpdateSeoAsync(new CreateOrUpdateSeoInput() { SeoEditDto = editDto }); status = true; } catch (Exception e) { status = false; message = e.Message; } return(Json(new { success = status, message = message })); }
public virtual async Task UpdateSeoAsync(SeoEditDto input) { //TODO:更新前的逻辑判断,是否允许更新 var entity = await _seoRepository.GetAsync(input.Id.Value); input.MapTo(entity); await _seoRepository.UpdateAsync(entity); }
public virtual async Task <SeoEditDto> CreateSeoAsync(SeoEditDto input) { //TODO:新增前的逻辑判断,是否允许新增 var entity = input.MapTo <Core.CustomDomain.Seo.Seo>(); entity = await _seoRepository.InsertAsync(entity); return(entity.MapTo <SeoEditDto>()); }
/// <summary> /// 通过Id获取SEO设置信息进行编辑或修改 /// </summary> public async Task <GetSeoForEditOutput> GetSeoForEditAsync(NullableIdDto <int> input) { var output = new GetSeoForEditOutput(); SeoEditDto seoEditDto; if (input.Id.HasValue) { var entity = await _seoRepository.GetAsync(input.Id.Value); seoEditDto = entity.MapTo <SeoEditDto>(); } else { seoEditDto = new SeoEditDto(); } output.Seo = seoEditDto; return(output); }