void Handle(Input.MoveUp action) { //What I want to do: check what number, first name and last name of the person on the row in //which the button was clicked. Save that in a temporary variable. Then, access the names and //number of the person above, and save that on the space below. Then, use the info in the temporary //variable to write in the row above the row in which the button was clicked. //(Then pretty much opposite for MoveDown) }
void Handle(Input.MoveUp Action) { //can only move up if it is not the first row if (this.SortOrder > 1) { //swap SortOrder values, execute as an atomic operation Db.Transact(() => { var previousPerson = Db.SQL <Person>("SELECT p FROM Person p WHERE SortOrder = ?", (this.SortOrder - 1)).First; previousPerson.SortOrder = this.SortOrder; this.SortOrder = this.SortOrder - 1; }); //refresh table binding this.ParentPage.RefreshPersonList(); } }