Create shared DTO classes
This commit is contained in:
parent
00136bc11b
commit
b52610e126
26
Start/Shared/BookmarkContainerDto.cs
Normal file
26
Start/Shared/BookmarkContainerDto.cs
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace Start.Shared {
|
||||||
|
public class BookmarkContainerDto {
|
||||||
|
public int BookmarkContainerId { get; set; }
|
||||||
|
[StringLength(300)]
|
||||||
|
public string Title { get; set; }
|
||||||
|
|
||||||
|
public IList<BookmarkGroupDto>? BookmarkGroups { get; set; }
|
||||||
|
|
||||||
|
public BookmarkContainerDto(string title) {
|
||||||
|
this.Title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BookmarkContainerDto(int bookmarkContainerId, string title) : this(title) {
|
||||||
|
this.BookmarkContainerId = bookmarkContainerId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BookmarkContainerDto(int bookmarkContainerId, string title,
|
||||||
|
IList<BookmarkGroupDto> bookmarkGroups) : this(bookmarkContainerId, title) {
|
||||||
|
this.BookmarkGroups = bookmarkGroups;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
25
Start/Shared/BookmarkDto.cs
Normal file
25
Start/Shared/BookmarkDto.cs
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
using System;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
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; }
|
||||||
|
|
||||||
|
public BookmarkDto(string title, string url, string? notes) {
|
||||||
|
this.Title = title;
|
||||||
|
this.Url = url;
|
||||||
|
this.Notes = notes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BookmarkDto(int bookmarkId, string title, string url, string? notes)
|
||||||
|
: this(title, url, notes) {
|
||||||
|
this.BookmarkId = bookmarkId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
30
Start/Shared/BookmarkGroupDto.cs
Normal file
30
Start/Shared/BookmarkGroupDto.cs
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace Start.Shared {
|
||||||
|
public class BookmarkGroupDto {
|
||||||
|
public int BookmarkGroupId { get; set; }
|
||||||
|
[StringLength(300)]
|
||||||
|
public string Title { get; set; }
|
||||||
|
[StringLength(6)]
|
||||||
|
public string Color { get; set; }
|
||||||
|
|
||||||
|
public IList<BookmarkDto>? Bookmarks { get; set; }
|
||||||
|
|
||||||
|
public BookmarkGroupDto(string title, string color) {
|
||||||
|
this.Title = title;
|
||||||
|
this.Color = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BookmarkGroupDto(int bookmarkGroupId, string title, string color)
|
||||||
|
: this(title, color) {
|
||||||
|
this.BookmarkGroupId = bookmarkGroupId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BookmarkGroupDto(int bookmarkGroupId, string title, string color,
|
||||||
|
IList<BookmarkDto> bookmarks) : this(bookmarkGroupId, title, color) {
|
||||||
|
this.Bookmarks = bookmarks;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue