Interface IBankRepository
- Namespace
- BankBackend.Repository
- Assembly
- BankBackend.dll
public interface IBankRepository
Methods
AddAccountToUser(int, int)
adds account with accountId to the account list of the user with userId
User? AddAccountToUser(int accountId, int userId)
Parameters
Returns
- User
the updated user with the added account, null if the user does not exist
AddUserToAccount(int, int)
adds user with userId to the account list of the account with accountId
Account? AddUserToAccount(int userId, int accountId)
Parameters
Returns
- Account
the updated account with the new user, null if account does not exist or if user does not exist
CreateAccount(Account)
uploads the account to database
Account CreateAccount(Account account)
Parameters
accountAccount
Returns
- Account
the account that was just created
CreateTransaction(Transaction)
uploads the transaction to database
Transaction CreateTransaction(Transaction transaction)
Parameters
transactionTransaction
Returns
- Transaction
the transaction that was just created
CreateUser(User)
uploads the user to database
User CreateUser(User user)
Parameters
userUser
Returns
- User
the user that was just created
DeleteAccountById(int)
deletes the account with accountId
Account? DeleteAccountById(int accountId)
Parameters
accountIdint
Returns
- Account
the account that was just deleted, null if the account does not exist
DeleteAccountUserByUserId(int, int)
deletes the user with userId from the account with accountId
User? DeleteAccountUserByUserId(int accountId, int userId)
Parameters
Returns
- User
the user that was just deleted, null if the account does not exist, or if the account does not have an user with
userId
DeleteTransactionByTransactionId(int)
deletes the transaction with transactionId
Transaction? DeleteTransactionByTransactionId(int transactionId)
Parameters
transactionIdint
Returns
- Transaction
the transaction that was just deleted, null if the transaction does not exist
DeleteUserAccountByAccountId(int, int)
deletes the account with accountId from the user with userId
Account? DeleteUserAccountByAccountId(int userId, int accountId)
Parameters
Returns
- Account
the account that was just deleted, null if user does not exist, or the user does not have an account with
accountId
DeleteUserById(int)
deletes the user with userId
User? DeleteUserById(int userId)
Parameters
userIdint
Returns
- User
the user that was just deleted, null if the user does not exist
GetAccountByAccountId(int)
find an account with accountId
Account? GetAccountByAccountId(int accountId)
Parameters
accountIdint
Returns
- Account
the account with
accountId, null if account does not exist
GetAccountsByUserId(int)
find all the accounts of the user with userId
List<Account>? GetAccountsByUserId(int userId)
Parameters
userIdint
Returns
GetAllAccounts()
find all existing accounts in the database
List<Account> GetAllAccounts()
Returns
GetAllTransactions()
find all existing transactions in the database
List<Transaction> GetAllTransactions()
Returns
- List<Transaction>
list containing all existing transactions, empty list if non exists
GetAllUsers()
find all existing users in the database
List<User> GetAllUsers()
Returns
GetPrimaryAccountsByUserId(int)
find all the accounts that the user with accountId is a primary user
List<Account>? GetPrimaryAccountsByUserId(int userId)
Parameters
userIdint
Returns
GetTransactionByTransactionId(int)
find a transaction with transactionId
Transaction? GetTransactionByTransactionId(int transactionId)
Parameters
transactionIdint
Returns
- Transaction
the transaction with
transactionId, null if transaction does not exist
GetTransactionsByFromAccountId(int)
List<Transaction> GetTransactionsByFromAccountId(int fromAccountId)
Parameters
fromAccountIdint
Returns
GetTransactionsByToAccountId(int)
List<Transaction> GetTransactionsByToAccountId(int toAccountId)
Parameters
toAccountIdint
Returns
GetUserByUserId(int)
find a user with userId
User? GetUserByUserId(int userId)
Parameters
userIdint
Returns
- User
the user with the Id, null if user does not exist
GetUserByUsername(string)
find a user with username
User? GetUserByUsername(string username)
Parameters
usernamestring
Returns
- User
the user with the username, null if user does not exist
GetUsersByAccountId(int)
find all the users of the account with accountId
List<User>? GetUsersByAccountId(int accountId)
Parameters
accountIdint
Returns
UpdateBalance(int, double)
updates the balance of the account with accountId to balance
Account? UpdateBalance(int accountId, double balance)
Parameters
Returns
- Account
the updated account with the new balance, null if the account does not exist
UpdatePassword(int, string)
updates the password of user with userId to password
User? UpdatePassword(int userId, string password)
Parameters
Returns
- User
the updated user with the new password, null if the user does not exist
UpdatePrimaryUser(int, int)
replaces the primary user of the account with accountId with userId
Account? UpdatePrimaryUser(int accountId, int userId)
Parameters
Returns
- Account
the updated account with the new primary user, null if account doesnot exist or if user does not exist
UpdateUsername(int, string)
updates the username of the user with userId to username
User? UpdateUsername(int userId, string username)
Parameters
Returns
- User
the updated user with the new username, null if the user does not exist