public IResult UpdateNote(string noteKey, IUpdateNoteParameters parameters) { if (noteKey == null) { throw new ArgumentNullException("noteKey"); } if (parameters == null) { throw new ArgumentNullException("parameters"); } var keyResult = KeyParserHelper.ParseResult <INoteKey>(noteKey); if (!keyResult.Success) { return(keyResult); } var parsedNoteKey = new NoteKey(keyResult.ResultingObject); var updateNoteResult = new UpdateNoteCommand(_notebookUnitOfWork).Execute(parsedNoteKey, _timeStamper.CurrentTimeStamp, parameters); if (!updateNoteResult.Success) { return(updateNoteResult); } _notebookUnitOfWork.Commit(); return(SyncParameters.Using(new SuccessResult(), new NotebookKey(parsedNoteKey))); }
internal IResult Execute(NoteKey noteKey, DateTime timestamp, IUpdateNoteParameters parameters) { if (noteKey == null) { throw new ArgumentNullException("noteKey "); } if (timestamp == null) { throw new ArgumentNullException("timestamp"); } if (parameters == null) { throw new ArgumentNullException("parameters"); } var note = _notebookUnitOfWork.NoteRepository.FindByKey(noteKey); if (note == null) { return(new InvalidResult(string.Format(UserMessages.NoteNotFound, noteKey.KeyValue))); } var employeeResult = new GetEmployeeCommand(_notebookUnitOfWork).GetEmployee(parameters); if (!employeeResult.Success) { return(employeeResult); } note.EmployeeId = employeeResult.ResultingObject.EmployeeId; note.TimeStamp = timestamp; note.Text = parameters.Text; return(new SuccessResult()); }
public IResult UpdateNote(string noteKey, IUpdateNoteParameters note) { try { return(_notebookServiceProvider.UpdateNote(noteKey, note)); } catch (Exception ex) { _exceptionLogger.LogException(ex); return(new FailureResult(ex.Message)); } }