public async Task <IActionResult> Get([FromQuery] PagingRequestModel model) { var accountMicroService = new AccountMicroService(_AppConfig.APIGatewayServer); var nationalUrbanMicroService = new NationalUrbanMicroService(_AppConfig.APIGatewayServer); var toDTO = new Func <MemberRegistry, Task <MemberRegistryDTO> >(async(entity) => { var dto = new MemberRegistryDTO(); dto.Id = entity.Id; dto.Name = entity.Name; dto.Description = entity.Description; dto.Creator = entity.Creator; dto.Modifier = entity.Modifier; dto.CreatedTime = entity.CreatedTime; dto.ModifiedTime = entity.ModifiedTime; dto.OrganizationId = entity.OrganizationId; dto.Province = entity.Province; dto.City = entity.City; dto.County = entity.County; dto.Phone = entity.Phone; dto.Mail = entity.Mail; dto.Company = entity.Company; dto.Inviter = entity.Inviter; dto.InviterName = await accountMicroService.GetNameById(entity.Inviter); await accountMicroService.GetNameByIds(entity.Creator, entity.Modifier, (creatorName, modifierName) => { dto.CreatorName = creatorName; dto.ModifierName = modifierName; }); await nationalUrbanMicroService.GetNameByIds(entity.Province, entity.City, entity.County, (provinceName, cityName, countyName) => { dto.ProvinceName = provinceName; dto.CityName = cityName; dto.CountyName = countyName; }); return(await Task.FromResult(dto)); }); var advanceQuery = new Func <IQueryable <MemberRegistry>, Task <IQueryable <MemberRegistry> > >(async(query) => { query = query.Where(x => x.OrganizationId == CurrentAccountOrganizationId && x.IsApprove == false); return(await Task.FromResult(query)); }); return(await _PagingRequest(model, toDTO, advanceQuery)); }
public override async Task <IActionResult> Get(string id) { var accountMicroService = new AccountMicroService(_AppConfig.APIGatewayServer); var nationalUrbanMicroService = new NationalUrbanMicroService(_AppConfig.APIGatewayServer); var toDTO = new Func <MemberRegistry, Task <MemberRegistryDTO> >(async(entity) => { var dto = new MemberRegistryDTO(); dto.Id = entity.Id; dto.Name = entity.Name; dto.Description = entity.Description; dto.Creator = entity.Creator; dto.Modifier = entity.Modifier; dto.CreatedTime = entity.CreatedTime; dto.ModifiedTime = entity.ModifiedTime; dto.OrganizationId = entity.OrganizationId; dto.Province = entity.Province; dto.City = entity.City; dto.County = entity.County; dto.Phone = entity.Phone; dto.Mail = entity.Mail; dto.Company = entity.Company; dto.Inviter = entity.Inviter; dto.InviterName = await accountMicroService.GetNameById(entity.Inviter); await accountMicroService.GetNameByIds(entity.Creator, entity.Modifier, (creatorName, modifierName) => { dto.CreatorName = creatorName; dto.ModifierName = modifierName; }); await nationalUrbanMicroService.GetNameByIds(entity.Province, entity.City, entity.County, (provinceName, cityName, countyName) => { dto.ProvinceName = provinceName; dto.CityName = cityName; dto.CountyName = countyName; }); return(await Task.FromResult(dto)); }); return(await _GetByIdRequest(id, toDTO)); }