public IActionResult SignatureUpdate()
        {
            _logger.LogInformation("Enter SignatureUpdate.");

            DroidValidationHandler handler = HttpContext.RequestServices.GetService(typeof(DroidValidationHandler)) as DroidValidationHandler;

            if (handler == null)
            {
                return(Problem("Object is not loaded.", typeof(DroidValidationHandler).Name));
            }

            handler.Logger = _logger;
            try
            {
                _logger.LogInformation("Execute handler ({0}).", typeof(DroidValidationHandler).Name);
                var result = handler.SetSignatureUpdate().Result;
            }
            catch (Exception e)
            {
                _logger.LogError(e, "An exception was thrown in {0}: '{1}'.", typeof(DroidValidationHandler).Name, e.Message);
                return(ValidationProblem(e.Message, typeof(DroidValidationHandler).Name));
            }

            _logger.LogInformation("Exit SignatureUpdate.");

            return(Ok());
        }
        public IActionResult Exporting(Guid guid)
        {
            if (guid == Guid.Empty)
            {
                return(Problem("Empty GUID is invalid."));
            }

            _logger.LogInformation("Enter Exporting.");

            string actionId = string.Empty;

            try
            {
                using (DroidValidationHandler handler = new DroidValidationHandler(_settings, _eventHub, _preingestCollection))
                {
                    handler.Logger = _logger;
                    handler.SetSessionGuid(guid);
                    _logger.LogInformation("Execute handler ({0}).", typeof(DroidValidationHandler).Name);
                    var result = handler.GetExporting().Result;
                    _logger.LogInformation("Exporting is completed.");
                    actionId = (result != null) ? result.ActionId : string.Empty;
                }
            }
            catch (Exception e)
            {
                _logger.LogError(e, "An exception was thrown in {0}: '{1}'.", typeof(DroidValidationHandler).Name, e.Message);
                return(ValidationProblem(e.Message, typeof(DroidValidationHandler).Name));
            }

            _logger.LogInformation("Exit Exporting.");

            return(new JsonResult(new { Message = String.Format("Droid exporting (CSV) is started."), SessionId = guid, ActionId = actionId }));
        }
        public IActionResult Reporting(Guid guid, String type)
        {
            if (guid == Guid.Empty)
            {
                return(Problem("Empty GUID is invalid."));
            }

            _logger.LogInformation("Enter Reporting.");

            DroidValidationHandler.ReportingStyle style = DroidValidationHandler.ReportingStyle.Pdf;
            switch (type)
            {
            case "pdf":
                style = DroidValidationHandler.ReportingStyle.Pdf;
                break;

            case "droid":
                style = DroidValidationHandler.ReportingStyle.Droid;
                break;

            case "planets":
                style = DroidValidationHandler.ReportingStyle.Planets;
                break;

            default:
                return(NotFound(String.Format("Unknown report type {0}", type)));
            }

            string actionId = string.Empty;

            try
            {
                using (DroidValidationHandler handler = new DroidValidationHandler(_settings, _eventHub, _preingestCollection))
                {
                    handler.Logger = _logger;
                    handler.SetSessionGuid(guid);
                    _logger.LogInformation("Execute handler ({0}).", typeof(DroidValidationHandler).Name);
                    var result = handler.GetReporting(style).Result;
                    _logger.LogInformation("Reporting is completed.");
                    actionId = (result != null) ? result.ActionId : string.Empty;
                }
            }
            catch (Exception e)
            {
                _logger.LogError(e, "An exception was thrown in {0}: '{1}'.", typeof(DroidValidationHandler).Name, e.Message);
                return(ValidationProblem(e.Message, typeof(DroidValidationHandler).Name));
            }

            _logger.LogInformation("Exit Reporting.");

            return(new JsonResult(new { Message = String.Format("Droid reporting ({0}) is started.", style), SessionId = guid, ActionId = actionId }));
        }