コード例 #1
0
        public Task <Result <RiskAssessmentResult> > GetRiskAnalysis(IPAddress ipAddress)
        {
            var random      = new Random();
            var probability = random.Next(100);

            // Return with 95 percent probability
            var isRiskFree = probability <= 95;

            if (!isRiskFree)
            {
                return(Task.FromResult(Result.Fail <RiskAssessmentResult>("fraudulent activity detected")));
            }

            var riskAssessmentResult = new RiskAssessmentResult(false, string.Empty);

            return(Task.FromResult(Result.Ok(riskAssessmentResult)));
        }
コード例 #2
0
        public IActionResult Create(CreateRiskAssessment request)
        {
            var result = new RiskAssessmentResult(Guid.NewGuid(), request.RiskAssessmentType, 0);

            return(Created($"riskassessments/{result.Id}", result));
        }