/// <summary> /// 新增UserQuestion /// </summary> //[AbpAuthorize(UserQuestionAppPermissions.UserQuestion_CreateUserQuestion)] protected virtual async Task <UserQuestionEditDto> CreateUserQuestionAsync(UserQuestionEditDto input) { //TODO:新增前的逻辑判断,是否允许新增 var entity = ObjectMapper.Map <UserQuestion>(input); entity = await _userquestionRepository.InsertAsync(entity); return(entity.MapTo <UserQuestionEditDto>()); }
/// <summary> /// 编辑UserQuestion /// </summary> //[AbpAuthorize(UserQuestionAppPermissions.UserQuestion_EditUserQuestion)] protected virtual async Task UpdateUserQuestionAsync(UserQuestionEditDto input) { //TODO:更新前的逻辑判断,是否允许更新 var entity = await _userquestionRepository.GetAsync(input.Id.Value); input.MapTo(entity); // ObjectMapper.Map(input, entity); await _userquestionRepository.UpdateAsync(entity); }
/// <summary> /// 导出UserQuestion为excel表 /// </summary> /// <returns></returns> //public async Task<FileDto> GetUserQuestionsToExcel(){ //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 <GetUserQuestionForEditOutput> GetUserQuestionForEdit(NullableIdDto <Guid> input) { var output = new GetUserQuestionForEditOutput(); UserQuestionEditDto userquestionEditDto; if (input.Id.HasValue) { var entity = await _userquestionRepository.GetAsync(input.Id.Value); userquestionEditDto = entity.MapTo <UserQuestionEditDto>(); //userquestionEditDto = ObjectMapper.Map<List <userquestionEditDto>>(entity); } else { userquestionEditDto = new UserQuestionEditDto(); } output.UserQuestion = userquestionEditDto; return(output); }