I am using ASP.Net and used EntityFramework to create my controller. In the controller there is the usual Delete and DeleteConfirmed actions. I don't ever want a user to actually delete a record but wouldn't mind that they think they deleted a record. My goal is to rework the delete confirmed record to change my RecordEntry table, IsValid column to 0 or false, meaning the record is marked as invalid rather than it being deleted.
This is the code for DeleteConfirmed. It has not yet been edited.
// POST: RecordEntry/Delete/5
[HttpPost, ActionName("Delete")]
[ValidateAntiForgeryToken]
public async Task<IActionResult> DeleteConfirmed(int id)
{
var recordEntry = await _context.RecordEntry.FindAsync(id);
_context.RecordEntry.Remove(recordEntry);
await _context.SaveChangesAsync();
return RedirectToAction(nameof(Index));
}