예제 #1
0
        public IActionResult Load(long?ID, long?DocumentID, long?RiskID, long?ProductAttachmentID, long?ClaimID, long?Level, long?langId)
        {
            GetAttachment operation = new GetAttachment();

            operation.ID                  = ID;
            operation.DocumentID          = DocumentID;
            operation.RiskID              = RiskID;
            operation.ProductAttachmentID = ProductAttachmentID;
            operation.ClaimID             = ClaimID;
            operation.Level               = Level;


            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));
            }
        }
예제 #2
0
        public async Task <Stream> Get(GetAttachment request)
        {
            var filePath = Path.Combine(dirPatch, request.Id);

            if (!File.Exists(filePath))
            {
                throw HttpError.BadRequest("Error: file does not exist");
            }

            return(File.OpenRead(filePath));
        }