public async Task <IActionResult> FundNoobWallet(FundNoobDto fundingDto) { if (!ModelState.IsValid) { return(BadRequest(ResponseMessage.Message("Invalid Model", ModelState, fundingDto))); } var currencyExist = _currencyRepository.CurrencyExist(fundingDto.CurrencyId); if (!currencyExist) { return(NotFound(ResponseMessage.Message("Currency Not found", "currency id provided is invalid", fundingDto))); } var user = _userRepository.GetUserById(fundingDto.WalletOwnerId); if (user == null) { return(NotFound(ResponseMessage.Message("User Not found", "user id provided is invalid", fundingDto))); } var wallet = _walletRepository.GetWalletsByUserId(user.Id).FirstOrDefault(); if (wallet == null) { return(NotFound(ResponseMessage.Message("Wallet not found", "user does not have a wallet", fundingDto))); } //var noobWalletFunded = await _walletRepository.FundNoobWallet(fundingDto); var noobWalletFunded = await _fundRepository.CreateFunding(fundingDto, wallet.Id); if (!noobWalletFunded) { return(BadRequest(ResponseMessage.Message("Unable to fund wallet", "An error was encountered while trying to fund the wallet", fundingDto))); } return(Ok(ResponseMessage.Message("Successfully funded, waiting approval from an Admin", null, fundingDto))); }