RazorPages/Pages/Climbs/Index.cshtml.cs

30 lines
754 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.EntityFrameworkCore;
using RazorPages.Data;
using RazorPages.Models;
namespace RazorPages.Pages.Climbs
{
public class IndexModel : PageModel
{
private readonly RazorPages.Data.RazorPagesClimbContext _context;
public IndexModel(RazorPages.Data.RazorPagesClimbContext context)
{
_context = context;
}
public IList<Climb> Climb { get;set; } = default!;
public async Task OnGetAsync()
{
Climb = await _context.Climb.ToListAsync();
}
}
}