public async Task Delete(int id) { var user = await _context.Users.FirstOrDefaultAsync(x => x.Id == id); if (user == null) { throw new NotFoundException("user", id); } _context.Remove(user); await _context.SaveChangesAsync(); }