예제 #1
0
파일: Link.cs 프로젝트: kazusapon/Kakeibo
        // 収入送信データを生成
        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);
            }
        }
예제 #2
0
파일: Link.cs 프로젝트: kazusapon/Kakeibo
        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);
            }
        }