Example #1
0
 /// <summary>
 /// Inserts the or update tag.
 /// </summary>
 /// <returns>The or update project.</returns>
 /// <param name="tag">Tag.</param>
 public int InsertOrUpdateTag(Tag tag)
 {
     return 	database.Table<Tag> ().Where (
         x => x.TagName == tag.TagName).Any ()
         ? database.Update (tag) : database.Insert (tag);
 }
Example #2
0
		private async void addNewClicked(object sender, EventArgs e){
			// Check to see if there is a tag
			if(newTagName != ""){
				// Check if user error/accident
				var response = await DisplayAlert("Confirmation", "Do you wish to add " + newTagName 
														+ ". Warning, doing this will uncheck all tags selected so far.", 
													"No, take me back", "Yes, add it");
				// No = true and yes is false hence !response
				if (!response) {
					if (!tlist.tagChecked.ContainsKey (newTagName)) {
						// Add new tag to database
						var database = new TagDatabase ();
						Tag t = new Tag (newTagName);
						database.InsertOrUpdateTag (t);
						tlist.addToDictionary (t.TagName);

						// Reload list
						await Navigation.PopModalAsync ();
						createTagChoices ();
					} else {
						await DisplayAlert ("Error:", "The tag name is already in the list, please check the entry field and try again.", "Back");
					}
				} 
			}else {
				await DisplayAlert ("Error:", "The tag name was not specified, please check the entry field and try again.", "Back");
			}
		}