Beispiel #1
0
        /// <summary>
        /// Retrieves the most recent 100 Runs from Database, Time Filtered
        /// </summary>
        /// <returns>Top 100 most recent Runs</returns>
        public async Task <List <Run> > GetTop100RunsAsync()
        {
            var result  = RunDatabase.Where <Run>(run => run.SubmissionTime < DateTime.UtcNow);
            var ordered = result.OrderByDescending(r => r.SubmissionTime);
            var top100  = ordered.Take <Run>(100);

            return(await top100.ToListAsync <Run>());
        }
Beispiel #2
0
        /// <summary>
        /// Gets a Run based on RunID
        /// </summary>
        /// <param name="runId">Id of Run</param>
        /// <returns>Run</returns>
        public async Task <Run> GetRunById(int runId)
        {
            // Because EF Core does not support Thread-Reentry, we want to handle any possible failure
            // cases within the method itself.
            try
            {
                var run = await RunDatabase.Where <Run>(r => r.RunId == runId).FirstOrDefaultAsync <Run>();

                return(run);
            }
            catch (Exception)
            {
                return(null);
            }
        }