BlazorStart/Start/Shared/BookmarkGroupDto.cs

41 lines
1.3 KiB
C#
Raw Normal View History

2021-12-05 23:50:48 +00:00
using System.Collections.Generic;
2021-11-14 04:27:59 +00:00
using System.ComponentModel.DataAnnotations;
2021-12-05 23:50:48 +00:00
using System.Text.Json.Serialization;
2021-11-14 04:27:59 +00:00
namespace Start.Shared {
public class BookmarkGroupDto {
public int BookmarkGroupId { get; set; }
2021-12-05 23:50:48 +00:00
[Required(AllowEmptyStrings = false, ErrorMessage = "Title is required")]
2021-11-14 04:27:59 +00:00
[StringLength(300)]
public string Title { get; set; }
2021-12-05 23:50:48 +00:00
[Required(AllowEmptyStrings = false, ErrorMessage = "Color is required")]
[StringLength(7)]
2021-11-14 04:27:59 +00:00
public string Color { get; set; }
2022-04-19 20:04:38 +00:00
public int SortOrder { get; set; }
2021-12-05 23:50:48 +00:00
public int BookmarkContainerId { get; set; }
2021-11-14 04:27:59 +00:00
public IList<BookmarkDto>? Bookmarks { get; set; }
2022-04-19 20:04:38 +00:00
public BookmarkGroupDto(string title, string color, int sortOrder,
int bookmarkContainerId) {
2021-11-14 04:27:59 +00:00
this.Title = title;
this.Color = color;
2022-04-19 20:04:38 +00:00
this.SortOrder = sortOrder;
2021-12-05 23:50:48 +00:00
this.BookmarkContainerId = bookmarkContainerId;
2021-11-14 04:27:59 +00:00
}
2022-04-19 20:04:38 +00:00
public BookmarkGroupDto(int bookmarkGroupId, string title, string color, int sortOrder,
2021-12-05 23:50:48 +00:00
int bookmarkContainerId)
2022-04-19 20:04:38 +00:00
: this(title, color, sortOrder, bookmarkContainerId) {
2021-11-14 04:27:59 +00:00
this.BookmarkGroupId = bookmarkGroupId;
}
2021-12-05 23:50:48 +00:00
[JsonConstructor]
2022-04-19 20:04:38 +00:00
public BookmarkGroupDto(int bookmarkGroupId, string title, string color, int sortOrder,
2021-12-05 23:50:48 +00:00
int bookmarkContainerId, IList<BookmarkDto>? bookmarks)
2022-04-19 20:04:38 +00:00
: this(bookmarkGroupId, title, color, sortOrder, bookmarkContainerId) {
2021-11-14 04:27:59 +00:00
this.Bookmarks = bookmarks;
}
}
}