File tree Expand file tree Collapse file tree 4 files changed +11
-11
lines changed
Expand file tree Collapse file tree 4 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -12,28 +12,28 @@ public SQLiteDatabase()
1212 _database . CreateTable < ContactFormModel > ( ) ;
1313 }
1414
15- public List < ContactFormModel > GetContactsAsync ( )
15+ public List < ContactFormModel > GetContacts ( )
1616 {
1717 List < ContactFormModel > contacts = _database . Table < ContactFormModel > ( ) . ToList ( ) ;
1818 return contacts . OrderBy ( x => x . Name [ 0 ] ) . ToList ( ) ;
1919 }
2020
21- public ContactFormModel GetContactAsync ( ContactFormModel item )
21+ public ContactFormModel GetContact ( ContactFormModel item )
2222 {
2323 return _database . Table < ContactFormModel > ( ) . Where ( i => i . ID == item . ID ) . FirstOrDefault ( ) ;
2424 }
2525
26- public int AddContactAsync ( ContactFormModel item )
26+ public int AddContact ( ContactFormModel item )
2727 {
2828 return _database . Insert ( item ) ;
2929 }
3030
31- public int DeleteContactAsync ( ContactFormModel item )
31+ public int DeleteContact ( ContactFormModel item )
3232 {
3333 return _database . Delete ( item ) ;
3434 }
3535
36- public int UpdateContactAsync ( ContactFormModel item )
36+ public int UpdateContact ( ContactFormModel item )
3737 {
3838 if ( item . ID != 0 )
3939 return _database . Update ( item ) ;
Original file line number Diff line number Diff line change @@ -32,9 +32,9 @@ private void PopulateDB()
3232 {
3333 foreach ( ContactFormModel contact in ContactsInfo )
3434 {
35- var item = App . Database . GetContactAsync ( contact ) ;
35+ var item = App . Database . GetContact ( contact ) ;
3636 if ( item == null )
37- App . Database . AddContactAsync ( contact ) ;
37+ App . Database . AddContact ( contact ) ;
3838 }
3939 }
4040
@@ -45,14 +45,14 @@ private async void OnCancelEdit()
4545
4646 private async void OnAddNewItem ( )
4747 {
48- App . Database . AddContactAsync ( SelectedItem ) ;
48+ App . Database . AddContact ( SelectedItem ) ;
4949 ContactsInfo . Add ( SelectedItem ) ;
5050 await App . Current . MainPage . Navigation . PopAsync ( ) ;
5151 }
5252
5353 private async void OnDeleteItem ( )
5454 {
55- App . Database . DeleteContactAsync ( SelectedItem ) ;
55+ App . Database . DeleteContact ( SelectedItem ) ;
5656 ContactsInfo . Remove ( SelectedItem ) ;
5757 await App . Current . MainPage . Navigation . PopAsync ( ) ;
5858 }
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ protected override void OnAppearing()
1515
1616 private void ContactFormBehavior_PropertyChanged ( object sender , System . ComponentModel . PropertyChangedEventArgs e )
1717 {
18- App . Database . UpdateContactAsync ( this . contactForm . DataObject as ContactFormModel ) ;
18+ App . Database . UpdateContact ( this . contactForm . DataObject as ContactFormModel ) ;
1919 }
2020 }
2121}
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ public MainPage()
1010
1111 private void MainPage_Loaded ( object sender , EventArgs e )
1212 {
13- listView . ItemsSource = App . Database . GetContactsAsync ( ) ;
13+ listView . ItemsSource = App . Database . GetContacts ( ) ;
1414 }
1515}
1616
You can’t perform that action at this time.
0 commit comments