• 番外篇-AppService服务


    一、

            public async Task<ListResultDto<ArchitectureDto>> GetArchitecture()
            {
                var architecture = _architectureRepository.GetAll();
                  var list= await architecture.ToListAsync();
                
    
                return new ListResultDto<ArchitectureDto>(
                    list.Select(item =>
                    {
                        var architectureDto = ObjectMapper.Map<ArchitectureDto>(item);
                        return architectureDto;
                    }).ToList());
            }
    

      

    二、

            public async Task<PagedResultDto<ArcClassroomListDto>> GetArchitectureClassroom(GetAllArchitecturesInput input)
            {
               var query = (from c in _classroomRepository.GetAll().Include("Architecture").Include("Nature").Include("Architecture.Parent.Parent").Include("Architecture.Children")
                             join a in _architectureRepository.GetAll() on c.ArchitectureId equals a.Id
                             join n in _natureRepository.GetAll() on c.NatureId equals n.Id
                            where a.Id == input.Id||a.ParentId== input.Id || a.Parent.ParentId == input.Id || a.Parent.Parent.ParentId == input.Id
                            select c);
               
                var totalCount = await query.CountAsync();
                
                var items = await query.OrderBy(input.Sorting?? "id asc").PageBy(input).ToListAsync();
              
                return new PagedResultDto<ArcClassroomListDto>(
                    totalCount,
                    items.Select(item =>
                    {
                           var organizationUnitUserDto = new ArcClassroomListDto();
                        organizationUnitUserDto.CampusName = item.Architecture.Parent.Parent.Name ;
                        organizationUnitUserDto.BuildingName = item.Architecture.Parent.Name;
                        organizationUnitUserDto.FloorName = item.Architecture.Name ;
                        organizationUnitUserDto.Name = item.Name;
                        organizationUnitUserDto.ClassroomNatureName = item.Nature.Name;
                        organizationUnitUserDto.Id = item.Id;
                        organizationUnitUserDto.Maximum = item.Maximum;
                        return organizationUnitUserDto;
                    }).ToList());
            }
    

      

  • 相关阅读:
    ioi1998 Polygon
    [Noip模拟题]Seq
    [noip模拟]分组行动
    入门OJ:photo
    Sgu167 I-country
    入门OJ:简单的网络游戏
    入门OJ:Coin
    ATT&CK实战系列
    Metasploit Framework(二)
    RoarCTF 2019
  • 原文地址:https://www.cnblogs.com/fger/p/10688742.html
Copyright © 2020-2023  润新知