Пример #1
0
        public HttpResponseMessage UploadTranslationDocument(HttpRequestMessage request)
        {
            try
            {
                var requestFromBase = Request;

                var multipartStream = requestFromBase.Content.ReadAsMultipartAsync().Result;
                foreach (var file in multipartStream.Contents)
                {
                    var filePath = SaveFile(file);

                    var uploadResponseDto = _documentService.AnalyzeDocument(filePath);

                    return(Request.CreateResponse(HttpStatusCode.OK, uploadResponseDto));
                }

                return(Request.CreateResponse(HttpStatusCode.InternalServerError));
            }
            catch (System.Exception e)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, e));
            }
        }