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