BlazorStart/Start/Shared/BookmarkDto.cs

31 lines
808 B
C#
Raw Normal View History

2021-12-14 00:27:13 +00:00
using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;
2021-11-14 04:27:59 +00:00
namespace Start.Shared {
public class BookmarkDto {
public int BookmarkId { get; set; }
[StringLength(300)]
public string Title { get; set; }
[StringLength(2000)]
public string Url { get; set; }
[StringLength(5000)]
public string? Notes { get; set; }
2021-12-14 00:27:13 +00:00
public int BookmarkGroupId { get; set; }
public BookmarkDto(string title, string url, string? notes, int bookmarkGroupId) {
2021-11-14 04:27:59 +00:00
this.Title = title;
this.Url = url;
this.Notes = notes;
2021-12-14 00:27:13 +00:00
this.BookmarkGroupId = bookmarkGroupId;
2021-11-14 04:27:59 +00:00
}
2021-12-14 00:27:13 +00:00
[JsonConstructor]
public BookmarkDto(int bookmarkId, string title, string url, string? notes,
int bookmarkGroupId)
: this(title, url, notes, bookmarkGroupId) {
2021-11-14 04:27:59 +00:00
this.BookmarkId = bookmarkId;
}
}
}