This commit is contained in:
elias
2023-08-06 23:12:45 +02:00
parent c8242217a5
commit 3c22d881ae
7 changed files with 222 additions and 8 deletions

55
Nevyn/Models/Budget.cs Normal file
View File

@@ -0,0 +1,55 @@
using System;
using MySql.Data.MySqlClient;
namespace Nevyn.Models
{
public class Budget
{
public int Id { get; set; }
public List<Category> Categories { get; set; }
public Budget()
{
}
//public void getBudgetFromSQL()
//this = Classes.Mysql.getBudget();
//}
public void updateFromDatabase()
{
Classes.Mysql mysql = new Classes.Mysql();
this.Categories = mysql.getBudgetCategories();
}
}
public class Category
{
public int ID { get; set; }
public string? Name { get; set; }
public int parent { get; set; }
public List<BudgetItem> Items { get; set; }
}
public class BudgetItem
{
public int ID { get; set; }
public string? Name { get; set; }
//public user User { get; set; }
public int Amount { get; set; }
public string? Description { get; set; }
public bool Recurring { get; set; }
public int Month { get; set; }
public int Year { get; set; }
}
public class BudgetDTO
{
public List<Category> Categories { get; set; }
public string Debug { get; set; }
}
}

View File

@@ -0,0 +1,16 @@
using System;
using Microsoft.EntityFrameworkCore;
namespace Nevyn.Models
{
public class BudgetContext : DbContext
{
public BudgetContext(DbContextOptions<BudgetContext> options) : base(options)
{
}
public DbSet<Budget> UpdateBudget { get; set; } = null!;
}
}

View File

@@ -54,10 +54,8 @@ namespace Nevyn.Models
Wallet dbWallet = mysql.SelectWallet();
this.Kort = dbWallet.Kort;
this.Spara = dbWallet.Spara;
this.Buffert = dbWallet.Buffert;
}
this.Buffert = dbWallet.Buffert;
}
}