public IActionResult CheckResult(string scanId)
        {
            var response = new CheckResultsResponse()
            {
                ScanId            = scanId,
                CompletedCallback = ResultFile.GetResults(scanId)
            };

            return(View(response));
        }
        public async Task <IActionResult> Submit(SubmitModel submitModel)
        {
            // A unique scan ID for the scan
            // In case this scan ID already exists for this user Copyleaks API will return HTTP 409 Conflict result
            string scanId   = Guid.NewGuid().ToString();
            var    response = new SubmitResponse()
            {
                ScanId = scanId,
                Token  = submitModel.Token
            };

            try
            {
                using (var api = new CopyleaksScansApi())
                {
                    // Submit a file for scan in https://api.copyleaks.com
                    await api.SubmitFileAsync(scanId, new FileDocument
                    {
                        // The text to scan in base64 format
                        Base64 = TextToBase64(submitModel.Text),
                        // The file name is it will appear in the scan result
                        Filename          = "text.txt",
                        PropertiesSection = GetScanProperties(scanId, submitModel)
                    },
                                              submitModel.Token).ConfigureAwait(false);
                }
                var checkResult = new CheckResultsResponse
                {
                    ScanId = scanId
                };
                return(View("CheckResult", checkResult));
            }
            catch (CopyleaksHttpException cfe)
            {
                response.ErrorMessage = cfe.Message;
            }
            catch (Exception ex)
            {
                response.ErrorMessage = ex.Message;
            }
            return(View(response));
        }