Beispiel #1
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Employee = await _context.Employee
                       .Include(e => e.Company)
                       .Include(e => e.Department)
                       .Include(e => e.EmployeeType)
                       .Include(e => e.Location)
                       .Include(e => e.Position).FirstOrDefaultAsync(m => m.EmployeeID == id);

            if (Employee == null)
            {
                return(NotFound());
            }
            ViewData["CompanyID"]      = new SelectList(_context.Company, "CompanyID", "CompanyID");
            ViewData["DepartmentID"]   = new SelectList(_context.Department, "DepartmentID", "DepartmentID");
            ViewData["EmployeeTypeID"] = new SelectList(_context.EmployeeType, "EmployeeTypeID", "EmployeeTypeID");
            ViewData["LocationID"]     = new SelectList(_context.Location, "LocationID", "LocationID");
            ViewData["PositionID"]     = new SelectList(_context.Set <Position>(), "PositionID", "PositionID");
            return(Page());
        }
Beispiel #2
0
 public IActionResult OnGet()
 {
     ViewData["CompanyID"]      = new SelectList(_context.Company, "CompanyID", "CompanyID");
     ViewData["DepartmentID"]   = new SelectList(_context.Department, "DepartmentID", "DepartmentID");
     ViewData["EmployeeTypeID"] = new SelectList(_context.EmployeeType, "EmployeeTypeID", "EmployeeTypeID");
     ViewData["LocationID"]     = new SelectList(_context.Location, "LocationID", "LocationID");
     ViewData["PositionID"]     = new SelectList(_context.Set <Position>(), "PositionID", "PositionID");
     return(Page());
 }