Beispiel #1
0
        public ListResultDto <AappraisalFileTypeListDto> GetAllAappraisalFileTypes(GetAappraisalFileTypeListInput input)
        {
            var query = _aappraisalFileTypeRepository.GetAll();
            var aappraisalFileTypes = query
                                      .OrderBy(input.Sorting)
                                      .ToList();
            var aappraisalFileTypeDtos = aappraisalFileTypes.MapTo <List <AappraisalFileTypeListDto> >();

            return(new ListResultDto <AappraisalFileTypeListDto> {
                Items = aappraisalFileTypeDtos
            });
        }
Beispiel #2
0
        public async Task <PagedResultDto <AappraisalFileTypeListDto> > GetAappraisalFileTypes(GetAappraisalFileTypeListInput input)
        {
            var query = from a in _aappraisalFileTypeRepository.GetAll()
                        join code in _code_AppraisalTypeRepository.GetAll() on a.AppraisalTypeId equals code.Id
                        select new AappraisalFileTypeListDto
            {
                Id   = a.Id,
                Name = a.Name,
                Sort = a.Sort,
                Code_AappTypeName = code.Name,
                AuditRoleIds      = a.AuditRoleIds,
                CreationTime      = a.CreationTime
            };

            var count = await query.CountAsync();

            var aappraisalFileTypes = await query
                                      .OrderByDescending(ite => ite.CreationTime)
                                      .PageBy(input)
                                      .ToListAsync();

            foreach (var a in aappraisalFileTypes)
            {
                if (string.IsNullOrWhiteSpace(a.AuditRoleIds) == false)
                {
                    var str = Array.ConvertAll(a.AuditRoleIds.Split(","), new Converter <string, string>(i => { return(((AuditRoleEnum)int.Parse(i)).ToString()); }));
                    a.AuditRoleIds = string.Join(",", str);
                }
                else
                {
                    a.AuditRoleIds = "全部";
                }
            }
            return(new PagedResultDto <AappraisalFileTypeListDto>(count, aappraisalFileTypes));
        }