using DXApp.TemplateKitProject.Data;
using DXApp.TemplateKitProject.Models;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.EntityFrameworkCore;

namespace DXApp.TemplateKitProject.Pages.Invoices;

public class IndexModel(AppDbContext db) : PageModel
{
    public List<ZugferdInvoice> Invoices { get; private set; } = [];

    public async Task OnGetAsync()
    {
        Invoices = await db.ZugferdInvoices
            .OrderByDescending(i => i.ImportedAt)
            .ToListAsync();
    }
}
