public async Task UpdateLocalization(LocalizationUpdateModel m, int @operator) { if (string.IsNullOrWhiteSpace(m.ResourceKey)) { throw new HopexException(_localizer["分类不能为空"]); } if (string.IsNullOrWhiteSpace(m.Key)) { throw new HopexException(_localizer["词条不能为空"]); } const string sql = @"replace into t_localization(culture,resourceKey,`key`,text,lastModifiedTime,hasTrans) values(@culture,@resourceKey,@key,@text,now(),@hasTrans);"; var localizations = m.Text.Select(x => new { culture = x.Culture, resourceKey = m.ResourceKey, key = m.Key, text = x.Text, hasTrans = !string.IsNullOrWhiteSpace(x.Text) }).ToList(); await _localizationRepository.Execute(sql, localizations); await NotifyResourceChanged(m.ResourceKey); }
public async Task <ActionResult> UpdateLocalization(LocalizationUpdateModel m) { await _localizationService.UpdateLocalization(m, User.GetId()); return(Ok()); }