コード例 #1
0
        /// <summary>
        /// Get geocache by Id.
        /// </summary>
        /// <param name="id">The id of the geocache.</param>
        /// <returns>GeocacheModel of the geocache.</returns>
        public async Task <GeocacheModel> GetGeocache(int id)
        {
            if (id <= 0)
            {
                throw new ArgumentException("Invalid id in DataService.GetGeocache()");
            }

            var geocache = await GeocachesQueries.GetGeocache(this.dbContext, id);

            return(geocache ?? new GeocacheModel());
        }
コード例 #2
0
        /// <summary>
        /// Get all geocaches.
        /// </summary>
        /// <returns>List GeocacheModel of all geocaches.</returns>
        public async Task <IEnumerable <GeocacheModel> > GetGeocaches()
        {
            var geocaches = await GeocachesQueries.GetGeocaches(this.dbContext);

            return(geocaches ?? new List <GeocacheModel>());
        }