From 09e65ee0d16c0cf60f746c479b5387b34daf9326 Mon Sep 17 00:00:00 2001 From: Drew Rautenberg Date: Wed, 8 Jan 2025 17:09:20 -0600 Subject: [PATCH] Rename and refactor inventory model to bark database model Renamed `inventoryModel.cs` to `barkDbModel.cs` and refactored the context class from `InventoryContext` to `BarkContext`. Consolidated inventory item properties into a new `InventoryItems` class for better organization and future scalability. --- .../{inventoryModel.cs => barkDbModel.cs} | 29 +++++++++++-------- 1 file changed, 17 insertions(+), 12 deletions(-) rename barkmanAPI/{inventoryModel.cs => barkDbModel.cs} (85%) diff --git a/barkmanAPI/inventoryModel.cs b/barkmanAPI/barkDbModel.cs similarity index 85% rename from barkmanAPI/inventoryModel.cs rename to barkmanAPI/barkDbModel.cs index dfa722e..7d12683 100644 --- a/barkmanAPI/inventoryModel.cs +++ b/barkmanAPI/barkDbModel.cs @@ -2,20 +2,13 @@ using Microsoft.EntityFrameworkCore; using System; using System.Collections.Generic; -public class InventoryContext : DbContext +public class BarkContext : DbContext { - public int Id {get; set;} - public string Name { get; set; } - public string Brand { get; set; } - public string? SerialNumber { get; set; } - public string? Status { get; set; } - public float? RentalPrice { get; set; } - public float? ReplacementCost { get; set; } - public string? Notes { get; set; } + public DbSet Inventory { get; set; } public string DbPath { get; } - public InventoryContext() + public BarkContext() { var folder = Environment.SpecialFolder.LocalApplicationData; var path = Environment.GetFolderPath(folder); @@ -26,5 +19,17 @@ public class InventoryContext : DbContext // special "local" folder for your platform. protected override void OnConfiguring(DbContextOptionsBuilder options) => options.UseSqlite($"Data Source={DbPath}"); - -} \ No newline at end of file +} + +public class InventoryItems +{ + public int Id {get; set;} + public string Name { get; set; } + public string Brand { get; set; } + public string? SerialNumber { get; set; } + public string? Status { get; set; } + public float? RentalPrice { get; set; } + public float? ReplacementCost { get; set; } + public string? Notes { get; set; } +} +