Exemplo n.º 1
0
        /// <summary>
        /// Get geocache item by Id.
        /// </summary>
        /// <param name="id">The id of the geocache item.</param>
        /// <returns>GeocacheItemModel of the geocache item.</returns>
        public async Task <GeocacheItemModel> GetGeocacheItem(int id)
        {
            if (id <= 0)
            {
                throw new ArgumentException("Invalid id in DataService.GetGeocacheItem(id)");
            }

            var geocacheItem = await GeocacheItemsQueries.GetGeocacheItem(this.dbContext, id);

            return(geocacheItem ?? new GeocacheItemModel());
        }
Exemplo n.º 2
0
        /// <summary>
        /// Get geocache item by name.
        /// </summary>
        /// <param name="name">The name of the geocache item.</param>
        /// <returns>GeocacheItemModel of the geocache item.</returns>
        public async Task <GeocacheItemModel> GetGeocacheItem(string name)
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentException("Invalid name in DataService.GetGeocacheItem(name)");
            }

            var geocacheItems = await GeocacheItemsQueries.GetGeocacheItem(this.dbContext, name);

            return(geocacheItems ?? new GeocacheItemModel());
        }