protected virtual async Task UpdateProjectMaterialInfoAsync(CreateOrUpdateProjectMaterialInfoInput input) { Debug.Assert(input.ProjectMaterialInfo.Id != null, "input.ProjectMaterialInfo.Id should be set."); var projectMaterialInfo = input.ProjectMaterialInfo.MapTo<BaseProjectMaterialInfo>(); projectMaterialInfo.LastModifierUserId = AbpSession.UserId; projectMaterialInfo.LastModifierUserName = GetCurrentUser().RealName; projectMaterialInfo.LastModificationTime = Clock.Now; await _projectMaterialInfoRepository.UpdateAsync(projectMaterialInfo); cacheHandler.Remove(CacheCategoryProjectMaterialInfo, "GetProjectMaterialInfoList"); }
protected virtual async Task CreateProjectMaterialInfoAsync(CreateOrUpdateProjectMaterialInfoInput input) { var projectMaterialInfo = input.ProjectMaterialInfo.MapTo<BaseProjectMaterialInfo>(); projectMaterialInfo.Id = GuidHelper.NewGuid(); projectMaterialInfo.OrgId = AbpSession.OrgId; projectMaterialInfo.CreatorUserId = AbpSession.UserId; projectMaterialInfo.CreatorUserName = GetCurrentUser().RealName; projectMaterialInfo.CreationTime = Clock.Now; await _projectMaterialInfoRepository.InsertAsync(projectMaterialInfo); cacheHandler.Remove(CacheCategoryProjectMaterialInfo, "GetProjectMaterialInfoList"); }
/// <summary> /// 添加修改实体 /// </summary> /// <param name="input"></param> /// <returns></returns> public async Task CreateOrUpdateProjectMaterialInfo(CreateOrUpdateProjectMaterialInfoInput input) { if (input.ProjectMaterialInfo.Id != null && input.ProjectMaterialInfo.Id != Guid.Empty) { await UpdateProjectMaterialInfoAsync(input); } else { await CreateProjectMaterialInfoAsync(input); } }