private void RecoverDatabase() { // Create Table connection.CreateTable<Branch>(); connection.CreateTable<Question>(); connection.CreateTable<OptionAnswers>(); // Adds record to Branch table var history = new Branch("Historia"); InsertAndUpdate(history); ReadItemFromFile("history.txt", 1); var geography = new Branch("Geografia"); InsertAndUpdate(geography); ReadItemFromFile("geography.txt", 2); }
private void BtnAdd_Click(object sender, EventArgs e) { dbSupport = new QuizDatabase(Resources.GetString(Resource.String.quizDatabaseName)); var n = dbSupport.BranchQuery.Where(x => x.Name.ToLower() == tvBranchName.Text.ToLower()).Count(); if (n == 0) { var branch = new Branch(tvBranchName.Text); dbSupport.InsertAndUpdate(branch); } else { Toast.MakeText(this, Resources.GetString(Resource.String.branchExsists), ToastLength.Long).Show(); } Finish(); }