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

            Payroll = await _context.Payroll
                      .Include(p => p.Employee).SingleOrDefaultAsync(m => m.PayrollId == id);

            if (Payroll == null)
            {
                return(NotFound());
            }
            return(Page());
        }
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Payroll = await _context.Payroll.FindAsync(id);

            if (Payroll != null)
            {
                _context.Payroll.Remove(Payroll);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Exemple #3
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Payroll = await _context.Payroll
                      .Include(p => p.Employee).SingleOrDefaultAsync(m => m.PayrollId == id);

            if (Payroll == null)
            {
                return(NotFound());
            }
            ViewData["EmployeeId"] = new SelectList(_context.Set <Employee>(), "EmployeeId", "EmployeeId");
            return(Page());
        }