diff --git a/WebServer/Components/Pages/Home.razor b/WebServer/Components/Pages/Home.razor index 2c3c320a..1a73f7eb 100644 --- a/WebServer/Components/Pages/Home.razor +++ b/WebServer/Components/Pages/Home.razor @@ -37,7 +37,7 @@
@cur.Symbol
@cur.Quantity
@cur.PurchasePrice
-
@cur.PurchaseDate.ToString("M-D-YYYY")
+
@cur.PurchaseDate.ToString("M-dd-yyyy")
} @@ -54,9 +54,12 @@ } - - - +
+
+ + + +
@resultError @@ -120,7 +123,7 @@ string dbPrefix = $"[{userName.ToLower()}]:"; // Set the DB prefix for the get and set string passwordhash = dbDriver.Get( dbPrefix + "password" ); // Pull the password hash if (BCrypt.Verify( passWord, passwordhash )){ // If the password is valid - List? stocks = JsonConvert.DeserializeObject>( dbDriver.Get( dbPrefix + "stock-data" ) ); + List? stocks = JsonConvert.DeserializeObject>( dbDriver.Get( dbPrefix + "Stocks" ) ); Session = new loginSession(){ UserName = userName.ToLower(), TrackedStocks = stocks != null ? stocks : new List() @@ -225,7 +228,7 @@ float StockPrice = 0; void buyStock(){ if (Session != null){ - + string dbPrefix = $"[{userName.ToLower()}]:"; // Try Parse the quantitiy input bool success = float.TryParse(buyStockQuantity, out float QuantityResult); if (!success){ @@ -240,13 +243,14 @@ return; } - // Add the item + // Add the stock Session.TrackedStocks.Add( new PurchasedStock(){ - Symbol = buyStockSymbol.ToLower(), + Symbol = buyStockSymbol.ToUpper(), PurchasePrice = StockPrice, Quantity = QuantityResult, PurchaseDate = DateTime.Now } ); + dbDriver.Set( dbPrefix + "Stocks", Newtonsoft.Json.JsonConvert.SerializeObject(Session.TrackedStocks) ); // Reset the Impodent Key result = PaymentProcessor.CreatePayment();