示例#1
0
        /// <summary>
        /// Retrieves a list of spells. Results can be filtered by passing in
        /// parameters through the query string.
        ///
        /// ROUTE
        /// `api/spell`
        ///
        /// RESPONSE BODY
        /// {
        ///     "spells": [
        ///         {
        ///             "id": `int`,
        ///             "name": `string`,
        ///             "level": `int`,
        ///             "school": `string`,
        ///             "castingTime": `string`,
        ///             "range": `string`,
        ///             "verbal": `bool`,
        ///             "somatic": `bool`,
        ///             "materials": `string`,
        ///             "duration": `string`,
        ///             "ritual": `bool`,
        ///             "description": `string`
        ///         },
        ///         .
        ///         .
        ///         .
        ///     ]
        /// }
        /// </summary>
        /// <returns>The response body.</returns>
        public async Task <SpellListResponse> Get([FromUri] SpellListFilter filter)
        {
            var spells = await _spellRepo.ListAsync(filter);

            var response = new SpellListResponse()
            {
                Spells = spells.Select(s => s.GetInfo()).ToList()
            };

            return(response);
        }