Test
This commit is contained in:
50
Nevyn/Controllers/BudgetController.cs
Normal file
50
Nevyn/Controllers/BudgetController.cs
Normal 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",
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user