Table of Contents

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

accountId int
userId int

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

userId int
accountId int

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

account Account

Returns

Account

the account that was just created

CreateTransaction(Transaction)

uploads the transaction to database

Transaction CreateTransaction(Transaction transaction)

Parameters

transaction Transaction

Returns

Transaction

the transaction that was just created

CreateUser(User)

uploads the user to database

User CreateUser(User user)

Parameters

user User

Returns

User

the user that was just created

DeleteAccountById(int)

deletes the account with accountId

Account? DeleteAccountById(int accountId)

Parameters

accountId int

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

accountId int
userId int

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

transactionId int

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

userId int
accountId int

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

userId int

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

accountId int

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

userId int

Returns

List<Account>

a list containing all the accounts, null if user does not exist

GetAllAccounts()

find all existing accounts in the database

List<Account> GetAllAccounts()

Returns

List<Account>

list containing all existing accounts, empty list if non exists

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

List<User>

a list containing all existing users, empty list if non exists

GetPrimaryAccountsByUserId(int)

find all the accounts that the user with accountId is a primary user

List<Account>? GetPrimaryAccountsByUserId(int userId)

Parameters

userId int

Returns

List<Account>

a list containing all the primary accounts, null if user does not exist

GetTransactionByTransactionId(int)

find a transaction with transactionId

Transaction? GetTransactionByTransactionId(int transactionId)

Parameters

transactionId int

Returns

Transaction

the transaction with transactionId, null if transaction does not exist

GetTransactionsByFromAccountId(int)

List<Transaction> GetTransactionsByFromAccountId(int fromAccountId)

Parameters

fromAccountId int

Returns

List<Transaction>

GetTransactionsByToAccountId(int)

List<Transaction> GetTransactionsByToAccountId(int toAccountId)

Parameters

toAccountId int

Returns

List<Transaction>

GetUserByUserId(int)

find a user with userId

User? GetUserByUserId(int userId)

Parameters

userId int

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

username string

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

accountId int

Returns

List<User>

a list containing all the users, null if account does not exist

UpdateBalance(int, double)

updates the balance of the account with accountId to balance

Account? UpdateBalance(int accountId, double balance)

Parameters

accountId int
balance double

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

userId int
password string

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

accountId int
userId int

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

userId int
username string

Returns

User

the updated user with the new username, null if the user does not exist