BlazorStart/Start/Server/Models/Bookmark.cs

41 lines
1.4 KiB
C#
Raw Normal View History

2022-04-19 20:04:38 +00:00
using System.ComponentModel.DataAnnotations;
2021-11-13 03:21:59 +00:00
namespace Start.Server.Models {
/// <summary>A bookmark with display text and a URL to link to</summary>
public class Bookmark {
/// <summary>A unique ID for the bookmark</summary>
[Key]
public int BookmarkId { get; set; }
/// <summary>The text to display for the bookmark</summary>
[MaxLength(300)]
public string Title { get; set; }
/// <summary>The URL the bookmark links to</summary>
[MaxLength(2000)] // De facto max length of URLs
public string Url { get; set; }
/// <summary>Arbitrary notes about the bookmark</summary>
[MaxLength(5000)]
public string? Notes { get; set; }
2022-04-19 20:04:38 +00:00
/// <summary>Used for sorting lists of bookmarks</summary>
public int SortOrder { get; set; }
2021-11-13 03:21:59 +00:00
/// <summary>The unique ID for the group the bookmark is in</summary>
public int BookmarkGroupId { get; set; }
/// <summary>The group the bookmark is in</summary>
public BookmarkGroup? BookmarkGroup { get; set; }
2022-04-19 20:04:38 +00:00
public Bookmark(string title, string url, string? notes, int sortOrder, int bookmarkGroupId) {
2021-11-13 03:21:59 +00:00
this.Title = title;
this.Url = url;
this.Notes = notes;
2022-04-19 20:04:38 +00:00
this.SortOrder = sortOrder;
2021-11-13 03:21:59 +00:00
this.BookmarkGroupId = bookmarkGroupId;
}
2022-04-19 20:04:38 +00:00
public Bookmark(int bookmarkId, string title, string url, string? notes, int sortOrder,
int bookmarkGroupId) : this(title, url, notes, sortOrder, bookmarkGroupId) {
2021-11-13 03:21:59 +00:00
this.BookmarkId = bookmarkId;
}
}
}