2021-12-05 23:50:48 +00:00
|
|
|
|
using System.Linq;
|
2021-11-16 05:44:16 +00:00
|
|
|
|
using Start.Server.Models;
|
|
|
|
|
using Start.Shared;
|
|
|
|
|
|
|
|
|
|
namespace Start.Server.Extensions {
|
|
|
|
|
public static class BookmarkMaps {
|
|
|
|
|
public static BookmarkDto MapToDto(this Bookmark bookmark) {
|
|
|
|
|
return new BookmarkDto(bookmark.BookmarkId, bookmark.Title, bookmark.Url,
|
2021-12-14 00:27:13 +00:00
|
|
|
|
bookmark.Notes, bookmark.BookmarkGroupId);
|
2021-11-16 05:44:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static BookmarkGroupDto MapToDto(this BookmarkGroup bookmarkGroup) {
|
|
|
|
|
return new BookmarkGroupDto(bookmarkGroup.BookmarkGroupId, bookmarkGroup.Title,
|
2021-12-05 23:50:48 +00:00
|
|
|
|
bookmarkGroup.Color, bookmarkGroup.BookmarkContainerId,
|
|
|
|
|
bookmarkGroup.Bookmarks?.Select(b => b.MapToDto()).ToList());
|
2021-11-16 05:44:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static BookmarkContainerDto MapToDto(this BookmarkContainer bookmarkContainer) {
|
|
|
|
|
return new BookmarkContainerDto(bookmarkContainer.BookmarkContainerId,
|
|
|
|
|
bookmarkContainer.Title,
|
|
|
|
|
bookmarkContainer.BookmarkGroups?.Select(bg => bg.MapToDto()).ToList());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|