public NoteOperationResponse Put([FromBody] NoteOperationRequest request) { return(new NoteOperationResponse() { OperationStatus = _notesManager.UpdateNote(request.Id, request.Content) }); }
public void SaveChanges() { if (!Note.NoteGUID.HasValue) { _notesManager.InsertNote(Note); } else { _notesManager.UpdateNote(Note); } }
public void AddNoteToDB(Entities.Note note) { note.content = note.content.Replace('\'', '"'); Entities.Note loadNote = manager.SearchIssueNote(note.issueNumber); if (loadNote != null) { manager.UpdateNote(note); } else { manager.AddNote(note); } }
private async void AddNotes_ToCollection(Notes obj) { //Add Notes to Server Animate = true; Instructions = "Adding Note"; //Diagnostics string Message = string.Empty; string StackTrace = string.Empty; bool _HasError = false; string cid = obj.Content_ID_Ref; //Temp Client Id await Task.Run(() => { try { Device.BeginInvokeOnMainThread(() => { var curr = new NotesCellViewModel(obj, navigation, dialogue); curr._DeleteContent += RemoveNote_FromCollection; this.Notes.Add(curr); }); DataVaultWebServiceClient dataService = new DataVaultWebServiceClient(ConfigurationManager.InSecurePublicBinding(), new System.ServiceModel.EndpointAddress(Constants.Data_InSecureUrl)); var response = dataService._AddNote(LocalMapper.MapNote_ToServer(obj)); if (response.Errors.Count != 0) { response.Errors.ForEach(w => { //Add to log table for diagnostics if (this.logging != null) { var log = LocalMapper.Map_LogWithMessage(w, Guid.NewGuid().ToString(), Guid.NewGuid().ToString()); this.logging.AddLog(log); } }); _HasError = true; } else { Device.BeginInvokeOnMainThread(() => { var note = this.Notes.SingleOrDefault(w => w.ID.Equals(cid)); note.ID = response.Content_ID; ReloadData = true; }); //Update local ID with the Server ID obj.Content_ID_Ref = response.Content_ID; _notesManager.UpdateNote(obj); } } catch (Exception ex) { _HasError = true; if (ex.InnerException != null) { Message = ex.InnerException.Message; StackTrace = ex.InnerException.StackTrace; } else { Message = ex.Message; StackTrace = ex.StackTrace; } var mEx = new Exceptions(logging, Message, StackTrace); if (mEx != null) { mEx.HandleException(mEx, logging); } } }).ContinueWith((e) => { Device.BeginInvokeOnMainThread(() => { Animate = false; //if () // dialogue.ShowAlert("mmm...Something went wrong", Message); }); }); }
public void Confirm() { try { if (string.IsNullOrWhiteSpace(Note)) { throw new ArgumentNullException("Note cannot be empty"); } if (!string.IsNullOrWhiteSpace(Constants.Note_ID)) { var note = _notesManager.Get_NoteByID <Notes>(Constants.Note_ID); if (note != null) { note.Subject = Subject; note.Description = Note; _notesManager.UpdateNote(note); MessagingCenter.Send <NotesCreatorViewModel, Notes>(this, _UpdateNote, note); } else { var obj = new Notes(); obj.Contact_ID_Ref = Constants.InMemory_ContactID; obj.Content_ID_Ref = Guid.NewGuid().ToString(); obj.Description = Note; obj.Subject = Subject; obj.Sys_Creation = DateTime.Now; obj.Sys_Transaction = DateTime.Now; _notesManager.AddNote(obj); MessagingCenter.Send <NotesCreatorViewModel, Notes>(this, _SendNote, obj); } } else { var obj = new Notes(); obj.Contact_ID_Ref = Constants.InMemory_ContactID; obj.Content_ID_Ref = Guid.NewGuid().ToString(); obj.Description = Note; obj.Subject = Subject; obj.Sys_Creation = DateTime.Now; obj.Sys_Transaction = DateTime.Now; _notesManager.AddNote(obj); MessagingCenter.Send <NotesCreatorViewModel, Notes>(this, _SendNote, obj); } //Pop to previous page if (navigation != null) { navigation.GoBackAsync(true); } } catch (Exception ex) { string eMessage = string.Empty; string eStackTrace = string.Empty; if (ex.InnerException != null) { eMessage = ex.InnerException.Message; eStackTrace = ex.InnerException.StackTrace; } else { eMessage = ex.Message; eStackTrace = ex.StackTrace; } var mEx = new Exceptions(logging, eMessage, eStackTrace); if (mEx != null) { mEx.HandleException(mEx, logging); } //Output a dialogue here if (dialogue != null) { dialogue.ShowAlert("mmm...Something went wrong", mEx.Message); } } }
public void UpdateNote(Note note) { notesManager.UpdateNote(note); }