/
Details.cshtml.cs
39 lines (33 loc) · 980 Bytes
/
Details.cshtml.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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 RazorPagesCore30.Models;
namespace RazorPagesCore30.Pages.Movies
{
public class DetailsModel : PageModel
{
private readonly RazorPagesCore30.Models.RazorPagesCore30Context _context;
public DetailsModel(RazorPagesCore30.Models.RazorPagesCore30Context context)
{
_context = context;
}
public Movie Movie { get; set; }
public async Task<IActionResult> OnGetAsync(int? id)
{
if (id == null)
{
return NotFound();
}
Movie = await _context.Movie.FirstOrDefaultAsync(m => m.ID == id);
if (Movie == null)
{
return NotFound();
}
return Page();
}
}
}