示例#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);
        }
示例#2
0
		private async Task ExecuteViewCommand(TripLogEntry entry)
		{
			await NavService.NavigateTo<DetailViewModel, TripLogEntry> (entry);
		}
示例#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;
			}
		}
示例#4
0
		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);
		}
示例#5
0
		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;
		}
示例#6
0
		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;
		}
示例#7
0
 public static string Serialize(TripLogEntry entry)
 {
     return(JsonConvert.SerializeObject(entry));
 }