Untitled
unknown
plain_text
a year ago
613 B
6
Indexable
public async Task<IActionResult> DeleteTool(int id) { try { var tool = await _context.Tools.FindAsync(id); if (tool == null) { return NotFound(); } _context.Tools.Remove(tool); await _context.SaveChangesAsync(); return NoContent(); // Return 204 No Content on successful deletion } catch (DbUpdateConcurrencyException ex) { // Log the error or handle it appropriately Console.WriteLine(ex.Message); return StatusCode(500, "An error occurred while deleting the tool."); } }
Editor is loading...
Leave a Comment