private string Url = "api.xxx.com/api/Users/"; private async Task<HttpClient> GetClient() { HttpClient client = new HttpClient(); client.DefaultRequestHeaders.Add("Accept", "application/json"); return client; } private async Task<MobileResult> Process(ViUserModel viUserModel, string processType) { HttpClient client = await GetClient(); // Insert işlemini gerçekleştirdik. var response = await client.PostAsync(Url + processType, new StringContent(JsonConvert.SerializeObject(viUserModel), Encoding.UTF8, "application/json")); var mobileResult = await response.Content.ReadAsStringAsync(); // Insert işleminin cevabını alıyoruz... var result = JsonConvert.DeserializeObject<MobileResult>(mobileResult); return result; } public async Task<MobileResult> GetAll(ViUserModel viUserModel, string keyCode) { return await Process(viUserModel, "GetAll?keyCode=" + keyCode); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)