public static int AddToFavorites(string username, string text) { string query = string.Format(AddToFavoritesQuery, username, text); iSqlQuery addToFavorites = new DB_NonQuery(query); return(addToFavorites.Execute()); }
public static int PurchaseStocks(int numberOfStocks, double stockUnitPrice, string userName, string email, string companyCode) { int availableFunds = CurrentBalance(userName); double moneyTryingToSpend = numberOfStocks * stockUnitPrice; if (moneyTryingToSpend > availableFunds) { return(-2); // not enough funds } string query = string.Format(purchaseStocksQuery, (availableFunds - moneyTryingToSpend), userName, email, companyCode, numberOfStocks, stockUnitPrice); iSqlQuery purchaseStock_Query = new DB_NonQuery(query); return(purchaseStock_Query.Execute()); }