Example #1
0
 public int DeleteItem(TodoItemModel item)
 {
     lock (Locker)
     {
         return(_db.Delete(item));//追加
     }
 }
Example #2
0
 //uodate
 public int SaveItem(TodoItemModel item)
 {
     lock (Locker) {
         if (item.ID != 0)   //ID is null update
         {
             _db.Update(item);
             return(item.ID);
         }
         return(_db.Insert(item)); //inserting
     }
 }
Example #3
0
 private void AddClicked(object sender, EventArgs e)
 {
     if (!String.IsNullOrEmpty(entry.Text))    //Entry
     {
         var item = new TodoItemModel {
             Text = entry.Text, CreatedAt = DateTime.Now, Delete = false
         };
         _db.SaveItem(item);
         list.ItemsSource = _db.GetItems();  //
         entry.Text       = "";
     }
 }
Example #4
0
 //更新・追加
 public int SaveItem(TodoItemModel item)
 {
     lock (Locker)
     {
         if (item.ID != 0)
         {//IDが0で無い場合は、更新
             _db.Update(item);
             return(item.ID);
         }
         return(_db.Insert(item));//追加
     }
 }