public IActionResult Load(long?ID, long?langId)
        {
            GetAttachments operation = new GetAttachments();

            operation.ID = ID;
            if (langId.HasValue)
            {
                operation.LangID = langId;
            }
            else
            {
                operation.LangID = 1;
            }

            var result = operation.QueryAsync().Result;

            if (result is ValidationsOutput)
            {
                return(Ok(new ApiResult <List <ValidationItem> >()
                {
                    Data = ((ValidationsOutput)result).Errors
                }));
            }
            else
            {
                return(Ok((List <Attachment>)result));
            }
        }
        public IActionResult LoadUnRelated(long?ID, long?ProductID, long?ProductDetailID, long?AttachmentLevel, long?langId)
        {
            GetProductAttachments operation  = new GetProductAttachments();
            GetAttachments        operation2 = new GetAttachments();

            operation.ID              = ID;
            operation.ProductId       = ProductID;
            operation.ProductDetailId = ProductDetailID;
            operation.AttachmentLevel = AttachmentLevel;

            if (langId.HasValue)
            {
                operation.LangID  = langId;
                operation2.LangID = langId;
            }
            else
            {
                operation.LangID  = 1;
                operation2.LangID = 1;
            }

            var result  = operation.QueryAsync().Result;
            var result2 = (List <Attachment>)operation2.QueryAsync().Result;

            List <ProductAttachment> RelatedAttachment   = new List <ProductAttachment>();
            List <Attachment>        UnRelatedAttachment = new List <Attachment>();



            var productAttachment = (List <ProductAttachment>)result;


            if (productAttachment.Count > 0)
            {
                RelatedAttachment = productAttachment.Where(p => result2.Any(s => s.ID == p.AttachmentID)).ToList();

                UnRelatedAttachment = result2.Where(s => productAttachment.Any(p => p.AttachmentID != s.ID)).ToList();

                UnRelatedAttachment = UnRelatedAttachment.Where(un => !RelatedAttachment.Exists(re => un.ID == re.AttachmentID)).ToList();
            }
            else
            {
                UnRelatedAttachment = result2;
            }


            if (result is ValidationsOutput)
            {
                return(Ok(new ApiResult <List <ValidationItem> >()
                {
                    Data = ((ValidationsOutput)result).Errors
                }));
            }
            else
            {
                return(Ok(new { RelatedAttachment, UnRelatedAttachment }));
            }
        }
Example #3
0
        public static void Main(string[] args)
        {
            //// ***********************************************************
            ////          GroupDocs.Viewer Cloud API Examples
            //// ***********************************************************

            //TODO: Get your Client Id and Client Secret at https://dashboard.groupdocs.cloud (free registration is required).
            Constants.MyClientId     = "XXXX-XXXX-XXXX-XXXX";
            Constants.MyClientSecret = "XXXXXXXXXXXXXXXX";
            Constants.MyStorage      = "First Storage";

            // Uploading sample test files from local disk to cloud storage
            Constants.UploadSampleTestFiles();

            #region Basic usage
            GetSupportedFormats.Run();
            GetDocumentInformation.Run();
            GetAttachments.Run();
            HtmlViewerExcludeFonts.Run();
            HtmlViewerMinifyHtml.Run();
            HtmlViewerResponsiveLayout.Run();
            ImageViewerAddTextOverlay.Run();
            ImageViewerAdjustImageSize.Run();
            ImageViewerAdjustJpgQuality.Run();
            ImageViewerGetTextCoordinates.Run();
            PdfViewerAdjustJpgQuality.Run();
            PdfViewerProtectPdf.Run();
            #endregion

            #region AdvancedUsage
            ViewProtectedDocument.Run();
            SpecifyEncoding.Run();
            RenderWithCustomFonts.Run();
            AddWatermark.Run();
            RenderComments.Run();
            RenderNotes.Run();
            RenderHiddenPages.Run();
            RenderConsecutivePages.Run();
            RenderSelectedPages.Run();
            ReplaceMissingFont.Run();
            ReorderPages.Run();
            FlipRotatePages.Run();
            GetInfoForArchiveFile.Run();
            RenderArchiveFolder.Run();
            AdjustOutputImageSize.Run();
            GetInfoForCadDrawing.Run();
            RenderAllLayouts.Run();
            RenderLayers.Run();
            RenderSingleLayout.Run();
            SplitIntoTiles.Run();
            AdjustPageSize.Run();
            RenameEmailFields.Run();
            GetInfoForProjectFile.Run();
            AdjustTimeUnit.Run();
            RenderTimeInterval.Run();
            GetInfoForOutlookDataFile.Run();
            LimitCountOfItemsToRender.Run();
            RenderFolder.Run();
            FilterMessages.Run();
            AdjustImageQuality.Run();
            DisableCharsGrouping.Run();
            EnableFontHinting.Run();
            EnableLayeredRendering.Run();
            GetInfoForPdfFile.Run();
            RenderOriginalPageSize.Run();
            AdjustTextOverflowInCells.Run();
            RenderSpreadsheetWithGridLines.Run();
            RenderHiddenColumnsAndRows.Run();
            RenderPrintAreas.Run();
            SkipRenderingOfEmptyColumns.Run();
            SkipRenderingOfEmptyRows.Run();
            SplitWorksheetsIntoPages.Run();
            RenderTrackedChanges.Run();

            SpecifyMaxCharsAndRows.Run();
            RenderVisioDocumentFigures.Run();
            FilterMailStorage.Run();
            HtmlViewerLimitImageSize.Run();
            HtmlViewerOptimizeForPrinting.Run();
            #endregion

            Console.WriteLine("Completed!");
            Console.ReadKey();
        }