Beispiel #1
0
        public override async Task <IActionResult> Get(string id)
        {
            var accountMicroService       = new AccountMicroService(_AppConfig.APIGatewayServer);
            var nationalUrbanMicroService = new NationalUrbanMicroService(_AppConfig.APIGatewayServer);

            var toDTO = new Func <WorkFlowRule, Task <WorkFlowRuleDTO> >(async(entity) =>
            {
                var dto          = new WorkFlowRuleDTO();
                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;
                var refWorFlow   = await _Context.WorkFlowRuleDetails.FirstOrDefaultAsync(x => x.OrganizationId == CurrentAccountOrganizationId && x.WorkFlowRuleId == entity.Id);
                if (refWorFlow != null)
                {
                    dto.WorkFlowId = refWorFlow.WorkFlowId;
                }

                await accountMicroService.GetNameByIds(entity.Creator, entity.Modifier, (creatorName, modifierName) =>
                {
                    dto.CreatorName  = creatorName;
                    dto.ModifierName = modifierName;
                });

                return(await Task.FromResult(dto));
            });

            return(await _GetByIdRequest(id, toDTO));
        }
Beispiel #2
0
        public async Task <IActionResult> Get([FromQuery] PagingRequestModel model)
        {
            var accountMicroService       = new AccountMicroService(_AppConfig.APIGatewayServer);
            var nationalUrbanMicroService = new NationalUrbanMicroService(_AppConfig.APIGatewayServer);

            var toDTO = new Func <WorkFlowRule, Task <WorkFlowRuleDTO> >(async(entity) =>
            {
                var dto          = new WorkFlowRuleDTO();
                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.IsInner      = entity.IsInner;
                await accountMicroService.GetNameByIds(entity.Creator, entity.Modifier, (creatorName, modifierName) =>
                {
                    dto.CreatorName  = creatorName;
                    dto.ModifierName = modifierName;
                });
                return(await Task.FromResult(dto));
            });

            return(await _PagingRequest(model, toDTO));
        }