private void CreateCharacters() { _conn.PopulateCharClassTable(); var clist = _conn.GetCharClasses(); int i = 0; foreach (var cClass in clist) { //Create a new Character of the specified class and insert it into the DB var pc = new Character(); pc.CharName = "Nash " + i; pc.ClassId = cClass.ClassId; pc.UserId = _id; _conn.InsertCharacter(pc); i++; //Get the Character back so it has an id and add it to the character list var npc = _conn.GetCharacterByName(pc.CharName); _clist.Add(npc); } }
async void createButton_Clicked(object sender, EventArgs e) { if (CheckClassNotNull()) { await DisplayAlert("Alert", "Please Select a Character Class", "OK"); } else if (_nameCheck == false) { await DisplayAlert("Alert", "Must enter a unique Character Name", "OK"); } else { var character = new Character(); character.CharName = nameEntry.Text; character.UserId = _userId; _conn.InsertCharacter(character); await DisplayAlert("Notification", "Character Created Successfullly", "OK"); await Navigation.PushAsync(new HomePage(_userId), true); } }