Created
January 9, 2016 19:00
-
-
Save wtuts/c5682506718bce76b058 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private async void Insert_Button_Click(object sender, RoutedEventArgs e) | |
{ | |
//Creating a new data object | |
var obj = new Database.Schema.Students | |
{ | |
Name = NameBox.Text, | |
Marks = Convert.ToInt32(MarksBox.Text) | |
}; | |
//If database exists | |
bool check = await Database.DatabaseHelper.Checkdatabase(); | |
if (check) | |
{ | |
//Check for null | |
if (obj.Name != String.Empty && obj.Marks.ToString() != String.Empty) | |
{ | |
//Inserting the record | |
Database.DatabaseHelper.AddNewStudent(obj); | |
var mm = new MessageDialog("Record Inserted"); | |
await mm.ShowAsync(); | |
} | |
else | |
{ | |
var mm = new MessageDialog("Invalid Fields"); | |
await mm.ShowAsync(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hi im new