コード例 #1
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());
            }
            return(Page());
        }
コード例 #2
0
        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"));
        }
コード例 #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());
        }