//----------------------------------------------------------// // D - Delete public bool DeleteUserById(int id) { var user = GetUserById(id); _context.Remove(user); return(_context.SaveChanges() != 0); }
public async Task <IActionResult> Delete(IFormCollection form) { int SessionEditID = (int)HttpContext.Session.GetInt32(nameof(SessionEditID)); SessionAccountNumber = (int)HttpContext.Session.GetInt32(nameof(SessionAccountNumber)); int.TryParse(form["BillPayID"], out int delId); if (delId == SessionEditID) { System.Diagnostics.Debug.WriteLine(" BP ID delete : " + delId); _context.Remove(await _context.BillPays.FindAsync(delId)); await _context.SaveChangesAsync(); } return(View("DisplayBP", await GetMyAccount(SessionAccountNumber))); }