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.
This commit is contained in:
2025-01-08 17:09:20 -06:00
parent c3e567494c
commit 09e65ee0d1
@@ -2,20 +2,13 @@ using Microsoft.EntityFrameworkCore;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
public class InventoryContext : DbContext public class BarkContext : DbContext
{ {
public int Id {get; set;} public DbSet<InventoryItems> Inventory { 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 string DbPath { get; } public string DbPath { get; }
public InventoryContext() public BarkContext()
{ {
var folder = Environment.SpecialFolder.LocalApplicationData; var folder = Environment.SpecialFolder.LocalApplicationData;
var path = Environment.GetFolderPath(folder); var path = Environment.GetFolderPath(folder);
@@ -26,5 +19,17 @@ public class InventoryContext : DbContext
// special "local" folder for your platform. // special "local" folder for your platform.
protected override void OnConfiguring(DbContextOptionsBuilder options) protected override void OnConfiguring(DbContextOptionsBuilder options)
=> options.UseSqlite($"Data Source={DbPath}"); => options.UseSqlite($"Data Source={DbPath}");
} }
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; }
}