public string GetAllCompetitions() { try { DBController dbc = new DBController(); List<Competition> allCompetitions = dbc.GetAllCompetitions(); dbc.Close(); return JsonConvert.SerializeObject(allCompetitions); } catch (Exception e) { Console.WriteLine(e.ToString()); DBController dbc = new DBController(); dbc.AddLog("GetAllCompetitions", null, null, null, e.ToString().Substring(0, Math.Min(e.ToString().Count(), 254)), ""); dbc.Close(); } return ""; }