void buttonSave_Clicked(object sender, EventArgs e) { var button = sender as Button; var id = Convert.ToInt32(button.CommandParameter); StackLayout displayTemplate; StackLayout editTemplate; GetDisplayAndEditTemplates(button, out displayTemplate, out editTemplate); var todo = new TodoViewModel { Name = editTemplate.FindByName<Entry>("entryName").Text, Notes = editTemplate.FindByName<Entry>("entryNotes").Text, }; this.ViewModel.Update(todo); displayTemplate.IsVisible = true; editTemplate.IsVisible = false; }
private void HandleAddNewTodoCommand() { // add new model to the database Todo todoModel = this.NewTodo.ToModel(); base.Database.Add <Todo>(todoModel); // update the UI var newTodo = new TodoViewModel { Name = this.NewTodo.Name, Notes = this.NewTodo.Notes }; this.todos.Add(newTodo); // clear input fields this.NewTodo.Name = string.Empty; this.NewTodo.Notes = string.Empty; }
private void HandleAddNewTodoCommand() { // add new model to the database Todo todoModel = this.NewTodo.ToModel(); base.Database.Add<Todo>(todoModel); // update the UI var newTodo = new TodoViewModel { Name = this.NewTodo.Name, Notes = this.NewTodo.Notes }; this.todos.Add(newTodo); // clear input fields this.NewTodo.Name = string.Empty; this.NewTodo.Notes = string.Empty; }
public void Update(TodoViewModel todo) { var todoModel = todo.ToModel(); base.Database.Update <Todo>(todoModel); }
public void Update(TodoViewModel todo) { var todoModel = todo.ToModel(); base.Database.Update<Todo>(todoModel); }