コード例 #1
0
        public async Task <ObservableCollection <FamousPerson> > FindAllAsync()
        {
            #region 测试
            using (var httpClient = new HttpClient())
            {
                try
                {
                    var response = await httpClient.GetAsync(FIND_URL);

                    if (response.IsSuccessStatusCode)
                    {
                        var result = await response.Content.ReadAsAsync <ObservableCollection <Fhr.ModernHistory.Models.FamousPerson> >();

                        var result2 = await response.Content.ReadAsAsync <ObservableCollection <FamousPerson> >();
                    }
                    else
                    {
                        var apiErrorModel = await response.Content.ReadAsAsync <ApiErrorModel>();

                        throw new ApiErrorException(apiErrorModel);
                    }
                }
                catch (Exception e)
                {
                    var apiErrorModel = new ApiErrorModel()
                    {
                        StatusCode = HttpStatusCode.NotFound,
                        Message    = "网络连接错误",
                        Code       = 3
                    };
                    throw new ApiErrorException(apiErrorModel);
                }
            }
            #endregion
            return(await HttpClientUtils.GetAsync <ObservableCollection <FamousPerson> >(FIND_URL));
        }
コード例 #2
0
        public async Task <FamousPerson> FindByIdAsync(int id)
        {
            var address = string.Format("{0}/{1}", FIND_URL, id);

            return(await HttpClientUtils.GetAsync <FamousPerson>(address));
        }
コード例 #3
0
 public async Task <ObservableCollection <PersonEventRelation> > FindAllAsync()
 {
     return(await HttpClientUtils.GetAsync <ObservableCollection <PersonEventRelation> >(FIND_URL));
 }
コード例 #4
0
        public async Task <HistoryEventType> FindByIdAsync(int id)
        {
            var address = string.Format("{0}/{1}", FIND_URL, id);

            return(await HttpClientUtils.GetAsync <HistoryEventType>(address));
        }
コード例 #5
0
 public async Task <ObservableCollection <HistoryEventType> > FindAllAsync()
 {
     return(await HttpClientUtils.GetAsync <ObservableCollection <HistoryEventType> >(FIND_URL));
 }
コード例 #6
0
 public async Task <ObservableCollection <FamousPersonType> > FindAllAsync()
 {
     return(await HttpClientUtils.GetAsync <ObservableCollection <FamousPersonType> >(FIND_URL));
 }