BlazorStart/Start/Server/Models/BookmarkGroup.cs

41 lines
1.4 KiB
C#
Raw Permalink Normal View History

2022-04-19 20:04:38 +00:00
using System.Collections.Generic;
2021-11-13 03:21:59 +00:00
using System.ComponentModel.DataAnnotations;
namespace Start.Server.Models {
/// <summary>A group of <see cref="Bookmark"/>s</summary>
public class BookmarkGroup {
/// <summary>A unique ID for the group</summary>
[Key]
public int BookmarkGroupId { get; set; }
/// <summary>The title of the group</summary>
[MaxLength(300)]
public string Title { get; set; }
/// <summary>A hex color for the group</summary>
[MaxLength(6)]
public string Color { get; set; }
2022-04-19 20:04:38 +00:00
/// <summary>Used for sorting lists of bookmark groups</summary>
public int SortOrder { get; set; }
2021-11-13 03:21:59 +00:00
/// <summary>The unique ID of the container this group is in</summary>
public int BookmarkContainerId { get; set; }
/// <summary>The container this group is in</summary>
public BookmarkContainer? BookmarkContainer { get; set; }
/// <summary>The bookmarks in this group</summary>
public List<Bookmark>? Bookmarks { get; set; }
2022-04-19 20:04:38 +00:00
public BookmarkGroup(string title, string color, int sortOrder, int bookmarkContainerId) {
2021-11-13 03:21:59 +00:00
this.Title = title;
this.Color = color;
2022-04-19 20:04:38 +00:00
this.SortOrder = sortOrder;
2021-11-14 01:19:28 +00:00
this.BookmarkContainerId = bookmarkContainerId;
2021-11-13 03:21:59 +00:00
}
2022-04-19 20:04:38 +00:00
public BookmarkGroup(int bookmarkGroupId, string title, string color, int sortOrder,
int bookmarkContainerId) : this(title, color, sortOrder, bookmarkContainerId) {
2021-11-13 03:21:59 +00:00
this.BookmarkGroupId = bookmarkGroupId;
}
}
}