// 収入送信データを生成 private async Task <IncomeFormat> GetUploadSpendListAsync() { using (var db = new MyContext()) { var _result = await db.Tra_Income .Where(x => x.Del_Flag == false) .Where(x => x.Created_At < x.Updated_At) .Where(x => x.Money == 0) .ToListAsync(); IncomeFormat spendFormat = new IncomeFormat() { Income = _result }; return(spendFormat); } }
private static async Task <Uri> UploadIncome() { IncomeFormat incomeFormat = new IncomeFormat(); using (var db = new MyContext()) { Income income = new Income(db); incomeFormat.Income = await income.GetUploadIncomeDataAsync(); HttpResponseMessage response = await httpClient.PostAsJsonAsync( apiPath, // APIエンドポイント incomeFormat // JSONデータ(おそらく自動でシリアライズしてくれるはず) ); response.EnsureSuccessStatusCode(); return(response.Headers.Location); } }