コード例 #1
0
        public async Task <IActionResult> CreateLoanApplication([FromBody] Loan_ApplicationDto loan_ApplicationDto,
                                                                CancellationToken cancellationToken = default)
        {
            string l = HttpContext.GetLoginFromClaims();

            var access = await validateUserFilter.ValidateUser(l, cancellationToken);

            if (access == "admin" || access == "null")
            {
                return(Unauthorized("ERROR, Access denied"));
            }

            var success = await loanService.ApplyForLoan(loan_ApplicationDto, cancellationToken);

            if (!success)
            {
                return(UnprocessableEntity("ERROR, Loan application cannot be send"));
            }

            return(Ok());
        }