public EditViewModel(INavigationService navigationService, IDataService dataService, IDialogService dialogService) { this.navigationService = navigationService; this.dataService = dataService; this.dialogService = dialogService; note = new MyNote { LatLong = new double[] { 0, 0 } }; }
public async Task SaveNote(MyNote mnote) { await DeleteNote(mnote); await AddNote(mnote); /*Cloud Service sagt immer no content*/ /*var note = MyNoteToNote(mnote); var json = JsonConvert.SerializeObject(note); await client.PutAsync($"{Uri}/{note.Id}", new JsonContent(json));*/ }
private Note MyNoteToNote(MyNote m) { return new Note() { Id=m.Id, CreatedAt=m.Date, Description=m.Content, Title=m.Header, Latitude=m.LatLong[0], Longitude=m.LatLong[1]}; }
public async Task DeleteNote(MyNote mnote) { var note = MyNoteToNote(mnote); await client.DeleteAsync($"{Uri}/{note.Id}"); }
public async Task AddNote(MyNote mnote) { var note = MyNoteToNote(mnote); var json = JsonConvert.SerializeObject(note); var response = await client.PostAsync(Uri, new JsonContent(json)); }