For fruit flies:
1/4 cup apple cider vinegar
10 drops of dish soap
Place in a small dish on your kitchen counter
Put all fruit away. By morning most will have drown. Let set 2 days then toss. If you still have some make a new batch.
For drain flies: Pour 1 quart bleach down drain. Let set 1 hour then flush with hot water.