Example #1
0
        public IHttpActionResult GetSpeciesById(int speciesId)
        {
            SpeciesService speciesService = CreateSpeciesService();
            var            species        = speciesService.GetSpeciesById(speciesId);

            if (species.HistoryId != null)
            {
                species.HistoryUrl = "https://" + HttpContext.Current.Request.Url.Authority + "/api/History?HistoryId=" + species.HistoryId;
            }
            return(Ok(species));
        }
Example #2
0
        /// <summary>
        /// 获取对应种类的对象列表
        /// </summary>
        /// <returns>种类对象列表或 null</returns>
        protected List <Species> GetDataOfSpecies()
        {
            List <Species> list = null;

            Int64 speciesId = GetSpeciesId();

            if (speciesId > 0)
            {
                list = SpeciesService.GetSpeciesById(speciesId);
            }
            else
            {
                throw new Exception("传递 URL 参数错误,话题 ID 格式不正确, 获取动态数据失败 -> GetDataOfSpecies()");
            }

            return(list);
        }