Skip to content

Instantly share code, notes, and snippets.

@wtuts
Created January 9, 2016 19:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wtuts/c5682506718bce76b058 to your computer and use it in GitHub Desktop.
Save wtuts/c5682506718bce76b058 to your computer and use it in GitHub Desktop.
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();
}
}
}
@shehanhasaranga
Copy link

hi im new

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment