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

View File

@@ -0,0 +1,50 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Nevyn.Models;
using Nevyn.Classes;
namespace Nevyn.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class BudgetController : ControllerBase
{
private readonly BudgetContext _context;
public BudgetController(BudgetContext context)
{
_context = context;
}
// GET: api/ShoppingLists
[HttpGet]
public async Task<ActionResult<BudgetDTO>> GetBudget()
{
//Budget budget = await _context.UpdateBudget.FindAsync(1);
Budget budget = new Budget();
budget.updateFromDatabase();
//_context.UpdateBudget.Add(budget);
//await _context.SaveChangesAsync();
return ItemToDTO(budget);
}
private static BudgetDTO ItemToDTO(Budget budget) =>
new BudgetDTO
{
Categories = budget.Categories,
Debug = "There is days left",
};
}
}