public Bookmark TryAddBookmark(IDataSource dataSource, LogLineIndex logLineIndex) { lock (_syncRoot) { var logFile = dataSource?.UnfilteredLogFile; if (logFile == null) { return(null); } if (!_dataSourcesByLogFile.ContainsKey(logFile)) { return(null); } if (logLineIndex >= logFile.Count) { return(null); } Bookmark bookmark = new Bookmark(dataSource, logLineIndex); if (_bookmarks.ContainsKey(bookmark)) { return(null); } var settings = bookmark.CreateSetting(); _bookmarks.Add(bookmark, settings); _settings.Add(settings); Update(); _settings.SaveAsync(); return(bookmark); } }
public ActionResult AddBookmark(BookmarkAddModel model) { bookmarks.Add(model); return(Ok()); }