From ed820f60fce9d1e196a60c05ca0b4636bafadd5f Mon Sep 17 00:00:00 2001 From: Lynnesbian Date: Fri, 18 Sep 2020 15:35:20 +1000 Subject: [PATCH] mostly working uploads 0u0 --- Pages/Documents/Edit.cshtml | 13 ++++++- Pages/Documents/Edit.cshtml.cs | 6 ++- Pages/Index.cshtml | 2 +- Pages/Shared/_Layout.cshtml | 5 ++- Pages/Upload.cshtml | 55 +++++++++++++++++++++++++++ Pages/Upload.cshtml.cs | 69 ++++++++++++++++++++++++++++++++++ ViewModels/EditDocument.cs | 10 +++-- ViewModels/UploadDocument.cs | 24 ++++++++++++ 8 files changed, 173 insertions(+), 11 deletions(-) create mode 100644 Pages/Upload.cshtml create mode 100644 Pages/Upload.cshtml.cs create mode 100644 ViewModels/UploadDocument.cs diff --git a/Pages/Documents/Edit.cshtml b/Pages/Documents/Edit.cshtml index 0f98120..a64744f 100644 --- a/Pages/Documents/Edit.cshtml +++ b/Pages/Documents/Edit.cshtml @@ -3,7 +3,7 @@ @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers @{ - ViewData["Title"] = "Edit"; + ViewData["Title"] = "Edit"; }
@@ -15,14 +15,23 @@ +
+ + +
+
+
+ + +
+
- @* *@ @Html.TextAreaFor(model => model.ed.Notes)
diff --git a/Pages/Documents/Edit.cshtml.cs b/Pages/Documents/Edit.cshtml.cs index f5b310a..ae35258 100644 --- a/Pages/Documents/Edit.cshtml.cs +++ b/Pages/Documents/Edit.cshtml.cs @@ -31,9 +31,9 @@ namespace Snootalogue.Pages.Documents { ed = new EditDocument { ID = Document.ID, Title = Document.Title, - Authors = Document.Authors, + Authors = string.Join(",", Document.Authors), Category = Document.Category, - Tags = Document.Tags, + Tags = Document.Tags == null ? "" : string.Join(",", Document.Tags), Read = Document.Read }; @@ -47,7 +47,9 @@ namespace Snootalogue.Pages.Documents { Document d = _context.Document.First(d => d.ID == ed.ID); d.Title = ed.Title; + d.Authors = ed.Authors.Split(",").ToList(); d.Category = ed.Category; + d.Tags = string.IsNullOrWhiteSpace(ed.Tags) ? null : ed.Tags.Split(",").ToList(); d.Notes = ed.Notes; d.Read = ed.Read; diff --git a/Pages/Index.cshtml b/Pages/Index.cshtml index 75b823e..a9117ab 100644 --- a/Pages/Index.cshtml +++ b/Pages/Index.cshtml @@ -16,7 +16,7 @@
By @Html.DisplayFor(modelItem => item.Authors)
Category: @Html.DisplayFor(modelItem => item.Category)
@Html.DisplayFor(modelItem => item.Tags)
- @{string hash = item.Hash.Substring(0, 8);} + @{string hash = item.Hash?.Substring(0, 8);}