public async Task CreateAllFunction(CreateOrUpdateFunctionInput input) { List<NameValue> abpAuthorizeAttributes = FindAbpAuthorizeAttributes(); if (abpAuthorizeAttributes.Count > 0) { foreach (var item in abpAuthorizeAttributes) { var function = input.FunctionInfo.MapTo<AuthorityFunctionInfo>(); function.Id = GuidHelper.NewGuid(); function.FuncCode = item.Name; function.FuncDescription = item.Value; await _functionRepository.InsertAsync(function); cacheHandler.Remove(CacheCategoryFunction, "GetFunctionList"); } } }
protected virtual async Task UpdateFunctionAsync(CreateOrUpdateFunctionInput input) { Debug.Assert(input.FunctionInfo.Id != null, "input.FunctionInfo.Id should be set."); var function = input.FunctionInfo.MapTo<AuthorityFunctionInfo>(); await _functionRepository.UpdateAsync(function); cacheHandler.Remove(CacheCategoryFunction, "GetFunctionList"); }
protected virtual async Task CreateFunctionAsync(CreateOrUpdateFunctionInput input) { var function = input.FunctionInfo.MapTo<AuthorityFunctionInfo>(); function.Id = GuidHelper.NewGuid(); await _functionRepository.InsertAsync(function); cacheHandler.Remove(CacheCategoryFunction, "GetFunctionList"); }
/// <summary> /// 添加修改实体 /// </summary> /// <param name="input"></param> /// <returns></returns> public async Task CreateOrUpdateFunction(CreateOrUpdateFunctionInput input) { if (input.FunctionInfo.Id != null && input.FunctionInfo.Id != Guid.Empty) { await UpdateFunctionAsync(input); } else { await CreateFunctionAsync(input); } }