43 lines
1.1 KiB
C#
43 lines
1.1 KiB
C#
#nullable disable
|
|
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 TicketOffice.Data;
|
|
using TicketOffice.Models;
|
|
|
|
namespace TicketOffice.Pages.Management.Cities
|
|
{
|
|
public class DetailsModel : PageModel
|
|
{
|
|
private readonly TicketOffice.Data.TicketOfficeContext _context;
|
|
|
|
public DetailsModel(TicketOffice.Data.TicketOfficeContext context)
|
|
{
|
|
_context = context;
|
|
}
|
|
|
|
public City City { get; set; }
|
|
|
|
public async Task<IActionResult> OnGetAsync(int? id)
|
|
{
|
|
if (id == null)
|
|
{
|
|
return NotFound();
|
|
}
|
|
|
|
City = await _context.City
|
|
.Include(c => c.Route).FirstOrDefaultAsync(m => m.Id == id);
|
|
|
|
if (City == null)
|
|
{
|
|
return NotFound();
|
|
}
|
|
return Page();
|
|
}
|
|
}
|
|
}
|