示例#1
0
        public async Task <IEnumerable <CloneReportResponseVM> > CloneReport(CloneReportRequestVM cloneReport)
        {
            var cloneReportRequest = new CloneReportRequest
            {
                ClientWorkSpaceId = cloneReport.ClientWorkSpaceId,
                ParentWorkSpaceId = cloneReport.ParentWorkSpaceId,
                CloneReports      = cloneReport.CloneReports.Select(w => new CloneReport {
                    CloneReportName = w.CloneReportName, ParentReportId = w.ParentReportId, WebApiEndPoint = w.WebApiEndPoint
                }).ToArray()
            };

            cloneReportRequest.Credential.SecretId      = cloneReport.Credential.SecretId;
            cloneReportRequest.Credential.TenantId      = cloneReport.Credential.TenantId;
            cloneReportRequest.Credential.ApplicationId = cloneReport.Credential.ApplicationId;

            var result = await _powerService.CloneReports(cloneReportRequest);

            var responseData = result;

            var responseList = new List <CloneReportResponseVM>();

            responseData.ForEach(s =>
            {
                responseList.Add(new CloneReportResponseVM
                {
                    CloneReportName  = s.CloneReportName,
                    ParentReportName = s.ParentReportName,
                    Success          = s.Success
                });
            });
            return(responseList.ToArray());
        }