Пример #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));
 }
        public async Task <HistoryEventType> FindByIdAsync(int id)
        {
            var address = string.Format("{0}/{1}", FIND_URL, id);

            return(await HttpClientUtils.GetAsync <HistoryEventType>(address));
        }
 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));
 }