/// <summary> /// 新增培训项目设置 /// </summary> // [AbpAuthorize(T_ItemAppPermissions.T_Item_CreateT_Item)] public virtual async Task <T_ItemEditDto> CreateT_ItemAsync(T_ItemEditDto input) { //TODO:新增前的逻辑判断,是否允许新增 input.CreateTime = DateTime.Now; var entity = input.MapTo <T_Item>(); entity = await _t_ItemRepository.InsertAsync(entity); return(entity.MapTo <T_ItemEditDto>()); }
//public List<T_ItemListDto> GetJoinItem(int userId) //{ // var entity = _t_ItemRepository.GetAll().Where(o => o.T_CInfos.FirstOrDefault(_ => _.Fk_CInfo_UserId == userId) != null && o.T_Require.UserName == null); // return entity.ToList().MapTo<List<T_ItemListDto>>(); //} /// <summary> /// 编辑培训项目设置 /// </summary> // [AbpAuthorize(T_ItemAppPermissions.T_Item_EditT_Item)] public virtual async Task UpdateT_ItemAsync(T_ItemEditDto input) { //TODO:更新前的逻辑判断,是否允许更新 var entity = await _t_ItemRepository.GetAsync(input.Id.Value); input.MapTo(entity); await _t_ItemRepository.UpdateAsync(entity); }
/// <summary> /// 通过Id获取培训项目设置信息进行编辑或修改 /// </summary> public async Task <GetT_ItemForEditOutput> GetT_ItemForEditAsync(NullableIdDto <int> input) { var output = new GetT_ItemForEditOutput(); T_ItemEditDto t_ItemEditDto; if (input.Id.HasValue) { var entity = await _t_ItemRepository.GetAsync(input.Id.Value); t_ItemEditDto = entity.MapTo <T_ItemEditDto>(); } else { t_ItemEditDto = new T_ItemEditDto(); } output.T_Item = t_ItemEditDto; return(output); }