public async void SaveNewNote() { if (!String.IsNullOrEmpty(NewTextTitle) && !String.IsNullOrEmpty(NewTextNote)) { var access = await Geolocator.RequestAccessAsync(); switch (access) { case GeolocationAccessStatus.Allowed: var geolocator = new Geolocator(); var geopositon = await geolocator.GetGeopositionAsync(); var geopoint = geopositon.Coordinate.Point; NewNoteLocation = geopoint; break; case GeolocationAccessStatus.Unspecified: case GeolocationAccessStatus.Denied: break; } var note = new Note(NewTextTitle, NewTextNote, DateTime.Now, NewNoteLocation); await dataService.AddNote(note); NewTextTitle = String.Empty; NewTextNote = String.Empty; _navigationService.GoBack(); } }
public HttpResponseMessage Post(Note note) { Check.If(note).IsNotNull(); Check.If(note.ApplicationReference).IsNotNullOrEmpty(); var result = _noteService.CreateNote(Mapper.Map<Core.Objects.Note>(note)); if (result == null) { return new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError }; } var response = new HttpResponseMessage { StatusCode = HttpStatusCode.Created }; response.Headers.Location = new Uri(Url.Link("GetNote", new {noteReference = result})); return response; }
public HttpResponseMessage Put(string noteReference, Note note) { Check.If(noteReference).IsNotNullOrEmpty(); Check.If(note).IsNotNull(); var result = _noteService.UpdateNote(noteReference, Mapper.Map<Core.Objects.Note>(note)); return result ? new HttpResponseMessage { StatusCode = HttpStatusCode.OK } : new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError }; }