public string Status() { var dbConnectionStatus = "DOWN"; try { var hours = _timeEntryRepository.TotalHours(); Console.WriteLine(string.Format("GET /status - DB OK. Total time entries: {0} h", hours)); dbConnectionStatus = "OK"; } catch (Exception exception) { Console.WriteLine("GET /status - database connection failed."); Console.WriteLine(exception.Message); } return(string.Format("Database connection: {0}", dbConnectionStatus)); }