Snootalogue/Pages/Index.cshtml.cs

23 lines
576 B
C#

using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.EntityFrameworkCore;
using Snootalogue.Models;
using System.Collections.Generic;
using System.Threading.Tasks;
using Snootalogue.Data;
namespace Snootalogue.Pages {
public class IndexModel : PageModel {
private readonly SnootalogueContext _context;
public IList<Document> Documents { get; set; }
public string Search { get; set; }
public IndexModel(SnootalogueContext context) {
_context = context;
}
public async Task OnGetAsync() {
Documents = await _context.Document.ToListAsync();
}
}
}