コード例 #1
0
        /// <inheritdoc />
        /// <summary>
        /// This method returns an IEnumerable of the resource type. RESTar will call this
        /// on GET requests and send the results back to the client as e.g. JSON.
        /// </summary>
        public IEnumerable <SuperheroReport> Select(IRequest <SuperheroReport> request)
        {
            var superHeroesOrdered = SQLite <Superhero>
                                     .Select()
                                     .OrderBy(r => r.RowId)
                                     .ToList();

            return(new[]
            {
                new SuperheroReport
                {
                    NumberOfSuperheroes = SQLite <Superhero> .Count(),
                    FirstSuperheroInserted = superHeroesOrdered.FirstOrDefault(),
                    LastSuperheroInserted = superHeroesOrdered.LastOrDefault(),
                }
            });
        }