public async Task <IActionResult> GetAsync(DateTime?realtime_start, DateTime?realtime_end, int?limit, int?offset, string order_by, string sort_order) { SourcesResponse result = new SourcesResponse(); try { api.Arguments.ApiKey = appSettings.ApiKey; api.Arguments.realtime_start = realtime_start ?? api.Arguments.realtime_start; api.Arguments.realtime_end = realtime_end ?? api.Arguments.realtime_end; api.Arguments.limit = limit ?? api.Arguments.limit; api.Arguments.offset = offset ?? api.Arguments.offset; var orderBy = ParseEnum <sources_order_by_values>(order_by); api.Arguments.order_by = orderBy ?? api.Arguments.order_by; var sortOrder = ParseEnum <sort_order_values>(sort_order); api.Arguments.sort_order = sortOrder ?? api.Arguments.sort_order; result.container = await api.FetchAsync(); SetApiValues(api, result); } catch (Exception exception) { logger.LogError(exception, "GetSources failed"); return(StatusCode(500)); } return(Ok(result)); }
public async Task <IActionResult> GetAsync(int id, DateTime?realtime_start, DateTime?realtime_end) { SourcesResponse result = new SourcesResponse(); try { api.Arguments.ApiKey = appSettings.ApiKey; api.Arguments.release_id = id; api.Arguments.realtime_start = realtime_start ?? api.Arguments.realtime_start; api.Arguments.realtime_end = realtime_end ?? api.Arguments.realtime_end; result.container = await api.FetchAsync(); SetApiValues(api, result); } catch (Exception exception) { logger.LogError(exception, "GetReleaseSources failed"); return(StatusCode(500)); } return(Ok(result)); }