44 lines
1.0 KiB
C#
44 lines
1.0 KiB
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 DetailsModel : PageModel
|
|
{
|
|
private readonly RazorPages.Data.RazorPagesClimbContext _context;
|
|
|
|
public DetailsModel(RazorPages.Data.RazorPagesClimbContext context)
|
|
{
|
|
_context = context;
|
|
}
|
|
|
|
public Climb Climb { get; set; } = default!;
|
|
|
|
public async Task<IActionResult> OnGetAsync(int? id)
|
|
{
|
|
if (id == null)
|
|
{
|
|
return NotFound();
|
|
}
|
|
|
|
var climb = await _context.Climb.FirstOrDefaultAsync(m => m.Id == id);
|
|
|
|
if (climb is not null)
|
|
{
|
|
Climb = climb;
|
|
|
|
return Page();
|
|
}
|
|
|
|
return NotFound();
|
|
}
|
|
}
|
|
}
|