Esempio n. 1
0
 public virtual async Task <PagedResultDto <WorkExperienceListDto> > GetListAsync(Guid employeeId, GetWorkExperiencesInput input)
 {
     return(await _workExperienceAppService.GetListAsync(employeeId, input));
 }
        /// <summary>
        /// 列表
        /// </summary>
        /// <param name="employeeId">员工Id</param>
        /// <param name="input">查询条件</param>
        /// <returns>结果</returns>
        public virtual async Task <PagedResultDto <WorkExperienceListDto> > GetListAsync(Guid employeeId, GetWorkExperiencesInput input)
        {
            await NormalizeMaxResultCountAsync(input);

            var queryable = await _workExperienceRepository.GetQueryableAsync();

            queryable = queryable.Where(w => w.EmployeeId == employeeId);

            long totalCount = await AsyncExecuter.CountAsync(queryable);

            var entities = await AsyncExecuter.ToListAsync(queryable
                                                           .OrderBy(input.Sorting ?? "Id DESC")
                                                           .Skip(input.SkipCount)
                                                           .Take(input.MaxResultCount));

            var dtos = ObjectMapper.Map <List <WorkExperience>, List <WorkExperienceListDto> >(entities);

            return(new PagedResultDto <WorkExperienceListDto>(totalCount, dtos));
        }