public async Task <string> GetTransmission(string apikey, double version, string returntype, int year, int month) { try { if (version.Equals(ApiVersion)) { if (!string.IsNullOrEmpty(returntype) && ValidReturnTypes != null && ValidReturnTypes.Contains(returntype.ToLower())) { if (!string.IsNullOrEmpty(apikey) && apikey.Length == 32 && ApiKey == apikey) { if (year > 2010) { if (month > 0 && month < 13) { if (!string.IsNullOrEmpty(ConnectionString)) { var tests = new List <string>() { "HIVVL", "HIVPC", "EID" }; var otherTests = Transmission.All(ApiConfiguration, tests, year, month, ConnectionString, true); var OpenLDRTests = Transmission.All(ApiConfiguration, tests, year, month, ConnectionString, false); var list = new List <Transmission>(); list.AddRange(otherTests); list.AddRange(OpenLDRTests); return(await list.ToReturnType(returntype)); } else { return(await Core.ToReturnType(new Response("Failed", "Month can only be 1 to 12"), returntype)); } } else { return(await Core.ToReturnType(new Response("Failed", "Month can only be 1 to 12"), returntype)); } } else { return(await Core.ToReturnType(new Response("Failed", "Year is lower than the minimum acceptable value"), returntype)); } } else { return(await Core.ToReturnType(new Response("Failed", "Invalid apikey"), returntype)); } } else { return(await Core.OutputText("Supported return types are json and xml only.")); } } else { return(await Core.OutputText("Version not yet implemented")); } } catch (Exception ex) { return(await Core.ToReturnType(new Response("Failed", ex.Message), "json")); } }