/// <summary> /// 编辑PlanProjectType /// </summary> protected virtual async Task UpdatePlanProjectTypeAsync(PlanProjectTypeEditDto input) { //TODO:更新前的逻辑判断,是否允许更新 var entity = await _planprojecttypeRepository.GetAsync(input.Id.Value); input.MapTo(entity); // ObjectMapper.Map(input, entity); await _planprojecttypeRepository.UpdateAsync(entity); }
/// <summary> /// 导出PlanProjectType为excel表 /// </summary> /// <returns></returns> //public async Task<FileDto> GetPlanProjectTypesToExcel(){ //var users = await UserManager.Users.ToListAsync(); //var userListDtos = ObjectMapper.Map<List<UserListDto>>(users); //await FillRoleNames(userListDtos); //return _userListExcelExporter.ExportToFile(userListDtos); //} /// <summary> /// MPA版本才会用到的方法 /// </summary> /// <param name="input"></param> /// <returns></returns> public async Task <GetPlanProjectTypeForEditOutput> GetPlanProjectTypeForEdit(NullableIdDto <int> input) { var output = new GetPlanProjectTypeForEditOutput(); PlanProjectTypeEditDto planprojecttypeEditDto; if (input.Id.HasValue) { var entity = await _planprojecttypeRepository.GetAsync(input.Id.Value); planprojecttypeEditDto = entity.MapTo <PlanProjectTypeEditDto>(); //planprojecttypeEditDto = ObjectMapper.Map<List <planprojecttypeEditDto>>(entity); } else { planprojecttypeEditDto = new PlanProjectTypeEditDto(); } output.PlanProjectType = planprojecttypeEditDto; return(output); }
/// <summary> /// 新增PlanProjectType /// </summary> protected virtual async Task <PlanProjectTypeEditDto> CreatePlanProjectTypeAsync(PlanProjectTypeEditDto input) { //TODO:新增前的逻辑判断,是否允许新增 var entity = ObjectMapper.Map <PlanProjectType>(input); entity = await _planprojecttypeRepository.InsertAsync(entity); return(entity.MapTo <PlanProjectTypeEditDto>()); }