Combination of two projects

Dear sir, my question is about combining two project. As i have made home automation from arduino mega 2560 and Ethernet shield and also connected 8 channel relay and it’s working perfect with LAN connection, but sir i have also perfomed samed project with Bluetooth connection i.e HC-05 Bluetooth module, but now my question is that can i use both at a time? Combine two codes and burn to arduino…? So that LAN connection is not available at every place so at that time i will use Bluetooth and when LAN is avaible i will use LAN. os it possible…?