async void CreateItemButton_Click(object sender, EventArgs e) { var newToDoItem = new ToDoItem { Title = "New Item", Description = "Some Description", CreatedAt = DateTime.UtcNow, IsComplete = false }; await repository.AddToDoItem(newToDoItem); var items = await repository.GetToDoItems(); Toast.MakeText(this, "Item created, there are " + items.Count + " in the database", ToastLength.Long).Show(); }
//Add new ToDoItem to DB public async Task AddToDoItem(ToDoItem todoItem) { await sqlConnection.InsertAsync(todoItem); }
//Delete specific ToDoItem public async Task DeleteToDoItem(ToDoItem todoItem) { await sqlConnection.DeleteAsync(todoItem); }