public async Task GetServiceKbArticle(AccessToken token, int id) { try { var result = await OkHttpUtils.Instance(token).GetAsyn(string.Format(ApiUtils.KbArticlesBody, id)); if (result.IsError) { kbarticleView.GetServiceKbArticleFail(result.Message); } else { await SQLiteUtils.Instance().QueryKbArticle(id).ContinueWith(async(response) => { var article = response.Result; article.Body = result.Message; await SQLiteUtils.Instance().UpdateKbArticle(article); kbarticleView.GetServiceKbArticleSuccess(article); }); } } catch (Exception ex) { kbarticleView.GetServiceKbArticleFail(ex.Message); } }
public async System.Threading.Tasks.Task GetServiceKbArticleListAsync(int pageIndex, int pageSize) { string url = string.Format(Constant.KBARTICLE_LIST, pageIndex, pageSize); await HttpClientUtil.GetAsync <List <KbArticleModel> >(url, null, async (list) => { kbArticleView.GetServiceKbArticleSuccess(list); await SqliteDatabase.Instance().UpdateKbArticleList(list); }, (error) => { kbArticleView.GetServiceKbArticleFail(error); }); }