示例#1
0
		public async Task<int> InsertOrUpdatePrompt(Activities prompt){
			//			return database.Table<Note> ().Where (x => x.NoteId == note.NoteId).Any () 
			//				? database.Update (note) : database.Insert (note);
			var lookup = await MobileService.GetTable<Activities> ().LookupAsync (prompt.id);
			if (lookup != null) {
				await MobileService.GetTable<Activities> ().InsertAsync (prompt);
			} else {
				await MobileService.GetTable<Activities> ().UpdateAsync (prompt);
			}
			return 1;

		}
示例#2
0
        public async Task <int> InsertOrUpdatePrompt(Activities prompt)
        {
            //			return database.Table<Note> ().Where (x => x.NoteId == note.NoteId).Any ()
            //				? database.Update (note) : database.Insert (note);
            var lookup = await MobileService.GetTable <Activities> ().LookupAsync(prompt.id);

            if (lookup != null)
            {
                await MobileService.GetTable <Activities> ().InsertAsync(prompt);
            }
            else
            {
                await MobileService.GetTable <Activities> ().UpdateAsync(prompt);
            }
            return(1);
        }
		public AddActivityPage()
		{
			BindingContext = App.Locator.AddActivity;
			InitializeComponent();
			base.Init();
			addStep.IsEnabled = false;
			Title = "Add Activity";
			BackgroundColor = Color.FromRgb(255, 255, 255);

			activity = new Activities ("default");

			if (!Application.Current.Properties.ContainsKey (NumberOfActivitiesKey)) {
				Application.Current.Properties.Add (NumberOfActivitiesKey, 0);
			}


		}