mirror of
https://github.com/Microsoft/sql-server-samples.git
synced 2025-12-08 14:58:54 +00:00
40 lines
965 B
C#
40 lines
965 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 ContosoHR.Models;
|
|
|
|
namespace ContosoHR.Pages.Employees
|
|
{
|
|
public class DetailsModel : PageModel
|
|
{
|
|
private readonly ContosoHR.Models.ContosoHRContext _context;
|
|
|
|
public DetailsModel(ContosoHR.Models.ContosoHRContext context)
|
|
{
|
|
_context = context;
|
|
}
|
|
|
|
public Employee Employee { get; set; }
|
|
|
|
public async Task<IActionResult> OnGetAsync(int? id)
|
|
{
|
|
if (id == null)
|
|
{
|
|
return NotFound();
|
|
}
|
|
|
|
Employee = await _context.Employees.FirstOrDefaultAsync(m => m.EmployeeId == id);
|
|
|
|
if (Employee == null)
|
|
{
|
|
return NotFound();
|
|
}
|
|
return Page();
|
|
}
|
|
}
|
|
}
|