BlazorStart/Start/Server/Models/Bookmark.cs
2021-11-12 19:21:59 -08:00

38 lines
1.2 KiB
C#

using System;
using System.ComponentModel.DataAnnotations;
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; }
/// <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; }
public Bookmark(string title, string url, int bookmarkGroupId) {
this.Title = title;
this.Url = url;
this.BookmarkGroupId = bookmarkGroupId;
}
public Bookmark(int bookmarkId, string title, string url, int bookmarkGroupId)
: this(title, url, bookmarkGroupId) {
this.BookmarkId = bookmarkId;
}
}
}