public IActionResult Create(long customerId, [FromBody] UserAccountCreateDto userAccountCreateDto) { bool uowStatus = false; try { uowStatus = _unitOfWork.BeginTransaction(); userAccountCreateDto.CustomerId = customerId; //TODO: Validations with Notification Pattern UserAccount userAccount = _userAccountCreateAssembler.toEntity(userAccountCreateDto); _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"))); } }
public UserAccount toEntity(UserAccountCreateDto userAccountCreateDto) { return(_mapper.Map <UserAccount>(userAccountCreateDto)); }