public async Task <IActionResult> OnGetAsync(long?id) { string uid = HttpContext.Session.GetString("uid"); if (uid == null) { return(RedirectToPage("../../Index")); } if (id == null) { return(NotFound()); } TblEmployeeRequestUserJob = await _context.TblEmployeeRequestUserJobs .Include(t => t.FldEmployeeRequestEmployee) .Include(t => t.FldEmployeeRequestJobs).FirstOrDefaultAsync(m => m.FldEmployeeRequestUserJobId == id); if (TblEmployeeRequestUserJob == null) { return(NotFound()); } ViewData["FldEmployeeRequestJobsId"] = new SelectList(_context.TblEmployeeRequestJobs, "FldEmployeeRequestJobsId", "FldEmployeeRequestJobsJobTitle"); return(Page()); }
public async Task <IActionResult> OnPostAsync(long?id) { string uid = HttpContext.Session.GetString("uid"); if (uid == null) { return(RedirectToPage("../../Index")); } if (id == null) { return(NotFound()); } TblEmployeeRequestUserJob = await _context.TblEmployeeRequestUserJobs.FindAsync(id); if (TblEmployeeRequestUserJob != null) { _context.TblEmployeeRequestUserJobs.Remove(TblEmployeeRequestUserJob); TblEmployeeRequestEmployeeEditLog t = new TblEmployeeRequestEmployeeEditLog() { FldEmployeeRequestEmployeeEditLogDate = DateTime.Now, FldEmployeeRequestUserId = Int64.Parse(uid), FldEmployeeRequestEmployeeId = TblEmployeeRequestUserJob.FldEmployeeRequestEmployeeId, FldEmployeeRequestEmployeeEditLogSection = "Job-Delete" }; _context.TblEmployeeRequestEmployeeEditLogs.Add(t); await _context.SaveChangesAsync(); } return(RedirectToPage("Index", new { id = TblEmployeeRequestUserJob.FldEmployeeRequestEmployeeId })); }