Test
This commit is contained in:
55
Nevyn/Models/Budget.cs
Normal file
55
Nevyn/Models/Budget.cs
Normal 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; }
|
||||
}
|
||||
}
|
||||
|
||||
16
Nevyn/Models/BudgetContext.cs
Normal file
16
Nevyn/Models/BudgetContext.cs
Normal 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!;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user