public IActionResult Create(long customerId, [FromBody] BankAccountCreateDto bankAccountCreateDto)
        {
            //LoggerBasSingleton.Instance.Log("Inicio de función");
            //LoggerThreadSafe1Singleton.Instance.Log("Inicio de función");
            //LoggerThreadSafe2Singleton.Instance.Log("Inicio de función");
            //LoggerThreadSafe3Singleton.Instance.Log("Inicio de función");
            LoggerThreadSafe4LazySingleton.Instance.Log("Inicio de función");

            bankAccountCreateDto.CustomerId = customerId;
            BankAccount bankAccount = _bankAccountCreateAssembler.toEntity(bankAccountCreateDto);

            _bankAccountRepository.Create(bankAccount);

            LoggerThreadSafe4LazySingleton.Instance.Log("Fin de función");

            return(StatusCode(StatusCodes.Status201Created, new ApiStringResponseDto("BankAccount Created!")));
        }
Example #2
0
        public IActionResult Create(long customerId, [FromBody] BankAccountCreateDto bankAccountCreateDto)
        {
            bool uowStatus = false;

            try
            {
                uowStatus = _unitOfWork.BeginTransaction();
                bankAccountCreateDto.CustomerId = customerId;
                //TODO: Validations with Notification Pattern
                BankAccount bankAccount = _bankAccountCreateAssembler.toEntity(bankAccountCreateDto);
                _bankAccountRepository.Create(bankAccount);
                _unitOfWork.Commit(uowStatus);
                return(StatusCode(StatusCodes.Status201Created, new ApiStringResponseDto("BankAccount Created!")));
            } catch (Exception ex) {
                _unitOfWork.Rollback(uowStatus);
                Console.WriteLine(ex.StackTrace);
                return(StatusCode(StatusCodes.Status500InternalServerError, new ApiStringResponseDto("Internal Server Error")));
            }
        }