Add create bookmark

This commit is contained in:
Neil Brommer 2021-12-13 16:27:13 -08:00
parent 64b893b778
commit 55625b1be4
19 changed files with 382 additions and 13 deletions

View file

@ -4,7 +4,7 @@ using System.Net.Http;
namespace Start.Shared.Api {
public interface IBookmarksApi {
[Get("{bookmarkId}")]
[Get("/{bookmarkId}")]
Task<ApiResponse<BookmarkDto?>> GetBookmark(int bookmarkId);
[Post("/Create")]

View file

@ -1,5 +1,5 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;
namespace Start.Shared {
public class BookmarkDto {
@ -11,14 +11,19 @@ namespace Start.Shared {
[StringLength(5000)]
public string? Notes { get; set; }
public BookmarkDto(string title, string url, string? notes) {
public int BookmarkGroupId { get; set; }
public BookmarkDto(string title, string url, string? notes, int bookmarkGroupId) {
this.Title = title;
this.Url = url;
this.Notes = notes;
this.BookmarkGroupId = bookmarkGroupId;
}
public BookmarkDto(int bookmarkId, string title, string url, string? notes)
: this(title, url, notes) {
[JsonConstructor]
public BookmarkDto(int bookmarkId, string title, string url, string? notes,
int bookmarkGroupId)
: this(title, url, notes, bookmarkGroupId) {
this.BookmarkId = bookmarkId;
}
}