OnPostAsync(long?id) { string uid = HttpContext.Session.GetString("uid"); if (uid == null) { return(RedirectToPage("../../Index")); } if (id == null) { return(NotFound()); } TblEmployeeRequestGeneralRecord = await _context.TblEmployeeRequestGeneralRecords.FindAsync(id); if (TblEmployeeRequestGeneralRecord != null) { _context.TblEmployeeRequestGeneralRecords.Remove(TblEmployeeRequestGeneralRecord); TblEmployeeRequestEmployeeEditLog t = new TblEmployeeRequestEmployeeEditLog() { FldEmployeeRequestEmployeeEditLogDate = DateTime.Now, FldEmployeeRequestUserId = Int64.Parse(uid), FldEmployeeRequestEmployeeId = TblEmployeeRequestGeneralRecord.FldEmployeeRequestEmployeeId, FldEmployeeRequestEmployeeEditLogSection = "General-Delete" }; _context.TblEmployeeRequestEmployeeEditLogs.Add(t); await _context.SaveChangesAsync(); } return(RedirectToPage("Index", new { id = TblEmployeeRequestGeneralRecord.FldEmployeeRequestEmployeeId })); }
public async Task <IActionResult> OnGetAsync(long?id) { string uid = HttpContext.Session.GetString("uid"); if (uid == null) { return(RedirectToPage("../../Index")); } if (id == null) { return(NotFound()); } TblEmployeeRequestGeneralRecord = await _context.TblEmployeeRequestGeneralRecords .Include(t => t.FldEmployeeRequestEmployee).FirstOrDefaultAsync(m => m.FldEmployeeRequestGeneralRecordId == id); if (TblEmployeeRequestGeneralRecord == null) { return(NotFound()); } return(Page()); }