Skip to content

Commit ac519aa

Browse files
Name short listed
1 parent bf757cb commit ac519aa

File tree

5 files changed

+11
-21
lines changed

5 files changed

+11
-21
lines changed

DataFormMAUI/DataBase/DatabaseConstants.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,8 @@ public static class DatabaseConstants
55
public const string DatabaseFilename = "DataFormSQLiteDB.db";
66

77
public const SQLite.SQLiteOpenFlags Flags =
8-
// open the database in read/write mode
98
SQLite.SQLiteOpenFlags.ReadWrite |
10-
// create the database if it doesn't exist
119
SQLite.SQLiteOpenFlags.Create |
12-
// enable multi-threaded database access
1310
SQLite.SQLiteOpenFlags.SharedCache;
1411

1512
public static string DatabasePath =>

DataFormMAUI/DataBase/SQLiteDatabase.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,24 @@ public SQLiteDatabase()
1212
_database.CreateTable<ContactFormModel>();
1313
}
1414

15-
public List<ContactFormModel> GetContactsAsync()
15+
public List<ContactFormModel> GetContactsAsync()
1616
{
17-
return _database.Table<ContactFormModel>().ToList();
17+
List<ContactFormModel> contacts = _database.Table<ContactFormModel>().ToList();
18+
return contacts.OrderBy(x => x.Name[0]).ToList();
1819
}
1920

20-
public ContactFormModel GetContactAsync(ContactFormModel item)
21+
public ContactFormModel GetContactAsync(ContactFormModel item)
2122
{
22-
return _database.Table<ContactFormModel>().Where(i => i.ID == item.ID).FirstOrDefault();
23+
return _database.Table<ContactFormModel>().Where(i => i.ID == item.ID).FirstOrDefault();
2324
}
24-
25+
2526
public int AddContactAsync(ContactFormModel item)
2627
{
27-
return _database.Insert(item);
28+
return _database.Insert(item);
2829
}
2930

3031
public int DeleteContactAsync(ContactFormModel item)
31-
{
32+
{
3233
return _database.Delete(item);
3334
}
3435

DataFormMAUI/DataFormMAUI.csproj.user

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<PropertyGroup>
44
<IsFirstTimeProjectOpen>False</IsFirstTimeProjectOpen>
5-
<ActiveDebugFramework>net8.0-android</ActiveDebugFramework>
6-
<ActiveDebugProfile>Xiaomi Mi A1 (Android 9.0 - API 28)</ActiveDebugProfile>
5+
<ActiveDebugFramework>net8.0-windows10.0.19041.0</ActiveDebugFramework>
6+
<ActiveDebugProfile>Windows Machine</ActiveDebugProfile>
77
<SelectedPlatformGroup>PhysicalDevice</SelectedPlatformGroup>
88
<DefaultDevice>tablet_m-dpi_10_1in_-_api_34</DefaultDevice>
99
</PropertyGroup>

DataFormMAUI/ViewModel/ContactsViewModel.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ public class ContactsViewModel
88
public ObservableCollection<ContactFormModel> ContactsInfo { get; set; }
99
public Command CreateContactsCommand { get; set; }
1010
public Command<object> EditContactsCommand { get; set; }
11-
public Command SaveItemCommand { get; set; }
1211
public Command DeleteItemCommand { get; set; }
1312
public Command AddItemCommand { get; set; }
1413
public Command CancelEditCommand { get; set; }
@@ -18,7 +17,6 @@ public ContactsViewModel()
1817
GenerateContacts();
1918
CreateContactsCommand = new Command(OnCreateContacts);
2019
EditContactsCommand = new Command<object>(OnEditContacts);
21-
SaveItemCommand = new Command(OnSaveItem);
2220
DeleteItemCommand = new Command(OnDeleteItem);
2321
AddItemCommand = new Command(OnAddNewItem);
2422
CancelEditCommand = new Command(OnCancelEdit);
@@ -38,8 +36,8 @@ private void PopulateDB()
3836
if (item == null)
3937
App.Database.AddContactAsync(contact);
4038
}
41-
4239
}
40+
4341
private async void OnCancelEdit()
4442
{
4543
await App.Current.MainPage.Navigation.PopAsync();
@@ -58,11 +56,6 @@ private async void OnDeleteItem()
5856
ContactsInfo.Remove(SelectedItem);
5957
await App.Current.MainPage.Navigation.PopAsync();
6058
}
61-
62-
private async void OnSaveItem()
63-
{
64-
}
65-
6659
private void OnEditContacts(object obj)
6760
{
6861
SelectedItem = (obj as Syncfusion.Maui.ListView.ItemTappedEventArgs).DataItem as ContactFormModel;

DataFormMAUI/Views/EditPage.xaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@
9595

9696
<Button Text="Save" CornerRadius="10" Grid.Row="2" x:Name="saveButton" BorderColor="Transparent" Background="{StaticResource PrimaryBrush}" TextColor="White"
9797
VerticalOptions="Center"
98-
Command="{Binding SaveItemCommand}"
9998
HorizontalOptions="Center" />
10099

101100
</HorizontalStackLayout>

0 commit comments

Comments
 (0)