public BookmarkRequestModel Find(BookmarkFindModel model) { var bookmarks = context.Bookmarks.Where(x => x.UserId == model.UserId && x.DocId == model.DocId && x.View == model.View && x.Page == model.Page && x.ScrollPos == model.ScrollPos); if (model.FolderId != null) { bookmarks = bookmarks.Where(x => x.FolderId == model.FolderId); } var result = bookmarks.Select(c => new BookmarkRequestModel { DateAdd = c.DateAdd, DocId = c.DocId, FolderId = c.FolderId, Id = c.Id, Name = c.Name, Page = c.Page, ScrollPos = c.ScrollPos, View = c.View }); return(result.FirstOrDefault()); }
public BookmarkRequestModel FindBookmark(BookmarkFindModel model) { return(bookmarks.Find(model)); }