Example #1
0
 public Task <int> SaveItemAsync(ClassData item)
 {
     if (item.ID != 0)
     {
         return(database.UpdateAsync(item));
     }
     else
     {
         return(database.InsertAsync(item));
     }
 }
        async void EditClicked(object sender, EventArgs e)
        {
            ClassData cd = new ClassData();

            try
            {
                cd          = BindingContext as ClassData;
                cd.Date     = DateTime.Parse(date.Text);
                cd.Class    = className.Text;
                cd.Quantity = quantiry.Text;
            }
            catch
            {
                await DisplayAlert("エラー", "日時を正しく入力してください", "閉じる");

                return;
            }

            await App.FoodDatabase.SaveItemAsync(cd);

            await DisplayAlert("成功", "内容を編集しました", "戻る");

            return;
        }
Example #3
0
 public Task <int> DeleteItemAsync(ClassData item)
 {
     return(database.DeleteAsync(item));
 }