Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. #nullable disable
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Threading.Tasks;
  6. using Microsoft.AspNetCore.Mvc;
  7. using Microsoft.AspNetCore.Mvc.RazorPages;
  8. using Microsoft.EntityFrameworkCore;
  9. using RazorMovie.Data;
  10. using RazorMovie.Models;
  11.  
  12. namespace RazorMovie.Pages.Movies
  13. {
  14. public class DetailsModel : PageModel
  15. {
  16. private readonly RazorMovie.Data.RazorMovieContext _context;
  17.  
  18. public DetailsModel(RazorMovie.Data.RazorMovieContext context)
  19. {
  20. _context = context;
  21. }
  22.  
  23. public Movie Movie { get; set; }
  24.  
  25. public async Task<IActionResult> OnGetAsync(int? id)
  26. {
  27. if (id == null)
  28. {
  29. return NotFound();
  30. }
  31.  
  32. Movie = await _context.Movie.FirstOrDefaultAsync(m => m.ID == id);
  33.  
  34. if (Movie == null)
  35. {
  36. return NotFound();
  37. }
  38. return Page();
  39. }
  40. }
  41. }
  42.