Beispiel #1
0
        public static TripLogEntry Deserialize(string serializedTripLogEntry)
        {
            var entry = JsonConvert.DeserializeObject <TripLogEntry>(serializedTripLogEntry);

            TripLogEntry result = new TripLogEntry
            {
                Id        = entry.Id,
                Title     = entry.Title,
                Latitude  = entry.Latitude,
                Longitude = entry.Longitude,
                Date      = entry.Date,
                Rating    = entry.Rating,
                Notes     = entry.Notes
            };

            return(result);
        }
Beispiel #2
0
		private async Task ExecuteViewCommand(TripLogEntry entry)
		{
			await NavService.NavigateTo<DetailViewModel, TripLogEntry> (entry);
		}
Beispiel #3
0
		private async Task ExecuteSaveCommand()
		{
			if (IsBusy)
				return;

			IsBusy = true;

			var newItem = new TripLogEntry {
				Title = this.Title,
				Latitude = this.Latitude,
				Longitude = this.Longitude,
				Date = this.Date,
				Rating = this.Rating,
				Notes = this.Notes
			};

			try 
			{
				await tripLogDataService.AddEntryAsync (newItem);
				await NavService.GoBack ();
			} 
			catch(Exception ex)
			{
				var message = ex.Message;
			}
			finally 
			{
				IsBusy = false;
			}
		}
		public async Task RemoveEntryAsync (TripLogEntry entry)
		{
			var url = new Uri (baseUri, string.Format ("tables/entry/{0}", entry.Id));
			var response = await SendRequestAsync<TripLogEntry> (url, HttpMethod.Delete, headers);
		}
		public async Task<TripLogEntry> UpdateEntryAsync (TripLogEntry entry)
		{
			var url = new Uri (baseUri, string.Format ("tables/entry/{0}", entry.Id));
			var response = await SendRequestAsync<TripLogEntry> (url, new HttpMethod ("PATCH"), headers, entry);
			return response;
		}
		public async Task<TripLogEntry> AddEntryAsync (TripLogEntry entry)
		{
			var url = new Uri (baseUri, "tables/entry");
			var response = await SendRequestAsync<TripLogEntry> (url, HttpMethod.Post, headers, entry);
			return response;
		}
Beispiel #7
0
 public static string Serialize(TripLogEntry entry)
 {
     return(JsonConvert.SerializeObject(entry));
 }