protected async virtual Task CreateCodeRuleAsync(CreateOrUpdateCodeRuleInput input) { var codeRule = input.CodeRule.MapTo<BaseCodeRuleInfo>(); codeRule.CreatorUserId = AbpSession.UserId; codeRule.CreatorUserName = GetCurrentUser().RealName; codeRule.CreationTime = Clock.Now; await _codeRuleRepository.InsertAsync(codeRule); cacheHandler.Remove(CacheCategoryCodeRule, "GetCodeRuleList"); }
protected async virtual Task UpdateCodeRuleAsync(CreateOrUpdateCodeRuleInput input) { Debug.Assert(input.CodeRule.Id != null, "input.CodeRule.Id should be set."); var codeRule = await _codeRuleRepository.GetAsync(input.CodeRule.Id); codeRule = input.CodeRule.MapTo<BaseCodeRuleInfo>(); codeRule.LastModifierUserId = AbpSession.UserId; codeRule.LastModifierUserName = GetCurrentUser().RealName; codeRule.LastModificationTime = Clock.Now; await _codeRuleRepository.UpdateAsync(codeRule); cacheHandler.Remove(CacheCategoryCodeRule, "GetCodeRuleList"); }
/// <summary> /// 添加修改实体 /// </summary> /// <param name="input"></param> /// <returns></returns> public async Task CreateOrUpdateCodeRule(CreateOrUpdateCodeRuleInput input) { if (input.CodeRule.Id != null && input.CodeRule.Id != Guid.Empty) { await UpdateCodeRuleAsync(input); } else { await CreateCodeRuleAsync(input); } }