From c46d39c26199391fac1ccea50d8d3c3b61f00caf Mon Sep 17 00:00:00 2001 From: k_atej Date: Sun, 10 Dec 2023 18:04:54 -0600 Subject: [PATCH 1/5] matching headers --- Pages/ListItems/Index.cshtml | 6 +++++- Pages/Lists/Create.cshtml | 12 +++++++----- Pages/Lists/Details.cshtml | 6 +++++- Pages/Lists/Edit.cshtml | 6 ++++-- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/Pages/ListItems/Index.cshtml b/Pages/ListItems/Index.cshtml index 66334d9..aa575e5 100644 --- a/Pages/ListItems/Index.cshtml +++ b/Pages/ListItems/Index.cshtml @@ -5,7 +5,11 @@ ViewData["Title"] = "Index"; } -

Index

+
+
+

List Items

+
+

Search for more! diff --git a/Pages/Lists/Create.cshtml b/Pages/Lists/Create.cshtml index 0b66286..acc00c7 100644 --- a/Pages/Lists/Create.cshtml +++ b/Pages/Lists/Create.cshtml @@ -10,12 +10,13 @@ @inject SignInManager SignInManager @inject UserManager UserManager -

Create

- -

Lists

-
+
+
+

Create List

+
+
-
+
@@ -41,3 +42,4 @@ @section Scripts { @{await Html.RenderPartialAsync("_ValidationScriptsPartial");} } + diff --git a/Pages/Lists/Details.cshtml b/Pages/Lists/Details.cshtml index 085c135..4fc918b 100644 --- a/Pages/Lists/Details.cshtml +++ b/Pages/Lists/Details.cshtml @@ -5,7 +5,11 @@ ViewData["Title"] = "Details"; } -

Details

+
+
+

List Details

+
+

Lists

diff --git a/Pages/Lists/Edit.cshtml b/Pages/Lists/Edit.cshtml index d190aa8..266027f 100644 --- a/Pages/Lists/Edit.cshtml +++ b/Pages/Lists/Edit.cshtml @@ -5,9 +5,11 @@ ViewData["Title"] = "Edit"; } -

Edit

+
+
+

Edit List

+
-

Lists


From 54dd2697c46d9ab4177763eeb3893f0667fa0ab1 Mon Sep 17 00:00:00 2001 From: k_atej Date: Mon, 11 Dec 2023 11:17:27 -0600 Subject: [PATCH 2/5] fixed empty list crash error --- Pages/ListItems/Index.cshtml | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/Pages/ListItems/Index.cshtml b/Pages/ListItems/Index.cshtml index 1ece7cc..bcf22ce 100644 --- a/Pages/ListItems/Index.cshtml +++ b/Pages/ListItems/Index.cshtml @@ -5,11 +5,13 @@ ViewData["Title"] = "Index"; } -

@Model.ListItems[0].List.Name

+@if (Model.ListItems.Count > 0) { -

- Search for more! -

+
+
+

@Model.ListItems[0].List.Name

+
+
@@ -46,3 +48,28 @@ }
+

+ Search for more! +

+ Return to My Lists! + } + else{ +
+
+

List is Empty!

+
+
+ +

+ Search for Plants! +

+ + Return to My Lists! + } + + \ No newline at end of file From 13df179b5043b959c7cc78f0ff834044587e9086 Mon Sep 17 00:00:00 2001 From: k_atej Date: Mon, 11 Dec 2023 11:17:43 -0600 Subject: [PATCH 3/5] standard headers, removed owner-id view --- Pages/Lists/Create.cshtml | 9 +++++++-- Pages/Lists/Delete.cshtml | 39 ++++++++++++++++++++++++++------------- Pages/Lists/Edit.cshtml | 10 ++++++++-- 3 files changed, 41 insertions(+), 17 deletions(-) diff --git a/Pages/Lists/Create.cshtml b/Pages/Lists/Create.cshtml index acc00c7..b55f6a8 100644 --- a/Pages/Lists/Create.cshtml +++ b/Pages/Lists/Create.cshtml @@ -24,7 +24,7 @@
-
+
@@ -34,7 +34,7 @@
- +
@@ -43,3 +43,8 @@ @{await Html.RenderPartialAsync("_ValidationScriptsPartial");} } + \ No newline at end of file diff --git a/Pages/Lists/Delete.cshtml b/Pages/Lists/Delete.cshtml index b0c1ac4..de5e665 100644 --- a/Pages/Lists/Delete.cshtml +++ b/Pages/Lists/Delete.cshtml @@ -5,26 +5,26 @@ ViewData["Title"] = "Delete"; } -

Delete

+
+
+

Delete

+
+
+ -

Are you sure you want to delete this?

-
-

Lists

-
-
+
+

Are you sure you want to delete this?

+
+
- @Html.DisplayNameFor(model => model.Lists.Name) + @Html.DisplayNameFor(model => model.Lists.Name):
@Html.DisplayFor(model => model.Lists.Name)
-
- @Html.DisplayNameFor(model => model.Lists.Owner) -
-
- @Html.DisplayFor(model => model.Lists.Owner.Id) -
+ +
@@ -32,3 +32,16 @@ Back to List
+ + \ No newline at end of file diff --git a/Pages/Lists/Edit.cshtml b/Pages/Lists/Edit.cshtml index 266027f..b45750a 100644 --- a/Pages/Lists/Edit.cshtml +++ b/Pages/Lists/Edit.cshtml @@ -21,7 +21,7 @@
-
+
@@ -32,7 +32,7 @@
- +
@@ -40,3 +40,9 @@ @section Scripts { @{await Html.RenderPartialAsync("_ValidationScriptsPartial");} } + + From c3e5bb1847053145febb7dc396f8f97039ff8edb Mon Sep 17 00:00:00 2001 From: k_atej Date: Mon, 11 Dec 2023 12:17:02 -0600 Subject: [PATCH 4/5] updated listitem edit, details, & delete to show info --- Models/ListItems.cs | 2 ++ Pages/ListItems/Create.cshtml | 6 +++- Pages/ListItems/Delete.cshtml | 23 +++++++------ Pages/ListItems/Delete.cshtml.cs | 4 +-- Pages/ListItems/Details.cshtml | 54 +++++++++++++++++++++++++------ Pages/ListItems/Details.cshtml.cs | 2 +- Pages/ListItems/Edit.cshtml | 16 ++++++--- Pages/ListItems/Index.cshtml | 8 +---- 8 files changed, 81 insertions(+), 34 deletions(-) diff --git a/Models/ListItems.cs b/Models/ListItems.cs index 1521f39..abcb906 100644 --- a/Models/ListItems.cs +++ b/Models/ListItems.cs @@ -1,3 +1,4 @@ +using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Microsoft.EntityFrameworkCore; @@ -13,6 +14,7 @@ public class ListItems [StringLength(255)] public int? LocationID { get; set; } [DataType(DataType.Date)] + [DisplayName("Date Added")] public DateTime TimeDiscovered { get; set; } [ForeignKey("KewID")] public Taxa? Plant { get; set; } diff --git a/Pages/ListItems/Create.cshtml b/Pages/ListItems/Create.cshtml index d585257..faf70c5 100644 --- a/Pages/ListItems/Create.cshtml +++ b/Pages/ListItems/Create.cshtml @@ -5,7 +5,11 @@ ViewData["Title"] = "Create"; } -

Create

+
+
+

Create

+
+

ListItems


diff --git a/Pages/ListItems/Delete.cshtml b/Pages/ListItems/Delete.cshtml index 4ef5f6e..bf48e92 100644 --- a/Pages/ListItems/Delete.cshtml +++ b/Pages/ListItems/Delete.cshtml @@ -5,37 +5,40 @@ ViewData["Title"] = "Delete"; } -

Delete

+
+
+

Delete

+
+

Are you sure you want to delete this?

-

ListItems

-
- @Html.DisplayNameFor(model => model.ListItems.TimeDiscovered) + @Html.DisplayNameFor(model => model.ListItems.TimeDiscovered):
@Html.DisplayFor(model => model.ListItems.TimeDiscovered)
- @Html.DisplayNameFor(model => model.ListItems.Plant) + @Html.DisplayNameFor(model => model.ListItems.Plant):
- @Html.DisplayFor(model => model.ListItems.Plant.KewID) + @Html.DisplayFor(model => model.ListItems.Plant.Name)
- @Html.DisplayNameFor(model => model.ListItems.List) + @Html.DisplayNameFor(model => model.ListItems.List):
- @Html.DisplayFor(model => model.ListItems.List.Id) + @Html.DisplayFor(model => model.ListItems.List.Name)
+
diff --git a/Pages/ListItems/Delete.cshtml.cs b/Pages/ListItems/Delete.cshtml.cs index 6d5fa30..1ff7e94 100644 --- a/Pages/ListItems/Delete.cshtml.cs +++ b/Pages/ListItems/Delete.cshtml.cs @@ -29,7 +29,7 @@ public async Task OnGetAsync(string id) return NotFound(); } - var listitems = await _context.ListItems.FirstOrDefaultAsync(m => m.KewID == id); + var listitems = await _context.ListItems.Include(l => l.Plant).Include(v => v.List).FirstOrDefaultAsync(m => m.KewID == id); if (listitems == null) { @@ -49,7 +49,7 @@ public async Task OnPostAsync(string id) return NotFound(); } - var listitems = await _context.ListItems.FirstOrDefaultAsync(m => m.KewID == id); + var listitems = await _context.ListItems.Include(t => t.Plant).FirstOrDefaultAsync(m => m.KewID == id); if (listitems != null) { diff --git a/Pages/ListItems/Details.cshtml b/Pages/ListItems/Details.cshtml index fdbb47e..1024dcf 100644 --- a/Pages/ListItems/Details.cshtml +++ b/Pages/ListItems/Details.cshtml @@ -5,11 +5,13 @@ ViewData["Title"] = "Details"; } -

Details

+
+
+

Details

+
+
-

ListItems

-
@Html.DisplayNameFor(model => model.ListItems.TimeDiscovered) @@ -18,26 +20,60 @@ @Html.DisplayFor(model => model.ListItems.TimeDiscovered)
- @Html.DisplayNameFor(model => model.ListItems.Plant) + @Html.DisplayNameFor(model => model.ListItems.List)
- @Html.DisplayFor(model => model.ListItems.Plant.KewID) + @Html.DisplayFor(model => model.ListItems.List.Name)
+
- @Html.DisplayNameFor(model => model.ListItems.List) + @Html.DisplayNameFor(model => model.ListItems.Plant.Genus.Family.Category) +
+
+ @Html.DisplayFor(model => model.ListItems.Plant.Genus.Family.Category.Description) +
+
+ @Html.DisplayNameFor(model => model.ListItems.Plant.Genus.Family) +
+
+ @Html.DisplayFor(model => model.ListItems.Plant.Genus.FamilyID) +
+
+ @Html.DisplayNameFor(model => model.ListItems.Plant.Genus) +
+
+ @Html.DisplayFor(model => model.ListItems.Plant.GenusID) +
+
+ @Html.DisplayNameFor(model => model.ListItems.Plant.SpecificEpithet) +
+
+ @Html.DisplayFor(model => model.ListItems.Plant.SpecificEpithet) +
+ @if (Model.ListItems.Plant.InfraspecificEpithet != null) { +
+ @Html.DisplayNameFor(model => model.ListItems.Plant.InfraspecificEpithet) +
+
+ @Html.DisplayFor(model => model.ListItems.Plant.InfraspecificEpithet) +
+
+ @Html.DisplayNameFor(model => model.ListItems.Plant.TaxonRank)
- @Html.DisplayFor(model => model.ListItems.List.Id) + @Html.DisplayFor(model => model.ListItems.Plant.TaxonRank)
+ } + +
- @Html.ActionLink("Edit", "Edit", new { /* id = Model.PrimaryKey */ }) | Back to List
diff --git a/Pages/ListItems/Details.cshtml.cs b/Pages/ListItems/Details.cshtml.cs index 53d596f..dfbf056 100644 --- a/Pages/ListItems/Details.cshtml.cs +++ b/Pages/ListItems/Details.cshtml.cs @@ -28,7 +28,7 @@ public async Task OnGetAsync(string id) return NotFound(); } - var listitems = await _context.ListItems.FirstOrDefaultAsync(m => m.KewID == id); + var listitems = await _context.ListItems.Include(l => l.Plant).Include(v => v.List).Include(g => g.Plant!.Genus).Include(f => f.Plant!.Genus!.Family).Include(c => c.Plant!.Genus!.Family!.Category).FirstOrDefaultAsync(m => m.KewID == id); if (listitems == null) { return NotFound(); diff --git a/Pages/ListItems/Edit.cshtml b/Pages/ListItems/Edit.cshtml index d46de40..2f5778d 100644 --- a/Pages/ListItems/Edit.cshtml +++ b/Pages/ListItems/Edit.cshtml @@ -5,17 +5,19 @@ ViewData["Title"] = "Edit"; } -

Edit

+
+
+

Edit

+
+
-

ListItems

-
-
+
@@ -39,3 +41,9 @@ @section Scripts { @{await Html.RenderPartialAsync("_ValidationScriptsPartial");} } + + \ No newline at end of file diff --git a/Pages/ListItems/Index.cshtml b/Pages/ListItems/Index.cshtml index bcf22ce..d890f21 100644 --- a/Pages/ListItems/Index.cshtml +++ b/Pages/ListItems/Index.cshtml @@ -21,9 +21,6 @@ @Html.DisplayNameFor(model => model.ListItems[0].Plant.Name) - - @Html.DisplayNameFor(model => model.ListItems[0].Location) - @@ -36,12 +33,9 @@ @Html.DisplayFor(modelItem => item.Plant.Name) - - @Html.DisplayFor(modelItem => item.Location.Id) - Edit | - Details | + Details | Delete From ce6448c157bfe753473a8938494a14c2a221c3b1 Mon Sep 17 00:00:00 2001 From: k_atej Date: Mon, 11 Dec 2023 12:39:21 -0600 Subject: [PATCH 5/5] removed weird image --- Pages/Index.cshtml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Pages/Index.cshtml b/Pages/Index.cshtml index 773df52..322a603 100644 --- a/Pages/Index.cshtml +++ b/Pages/Index.cshtml @@ -27,12 +27,11 @@ var randomImage = new Array(); // can add as whatever images as we want - randomImage[0] = "https://images.unsplash.com/photo-1487700160041-babef9c3cb55?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8NHx8cGxhbnQlMjB3aGl0ZXxlbnwwfHwwfHx8MA%3D%3D&w=1000&q=80" - randomImage[1] = "https://images.unsplash.com/photo-1536762131871-17373957273e?q=80&w=2940&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D" - randomImage[2] = "https://images.unsplash.com/photo-1431263154979-0982327fccbb?q=80&w=2670&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D" - randomImage[3] = "https://images.unsplash.com/photo-1516613835066-91cb1a42dda5?q=80&w=2940&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D" - randomImage[4] = "https://images.unsplash.com/photo-1562504979-5aee5dc1cc2c?q=80&w=2940&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D" - randomImage[5] = "https://images.unsplash.com/photo-1606922604118-c1aff542a1a9?q=80&w=2844&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D" + randomImage[0] = "https://images.unsplash.com/photo-1536762131871-17373957273e?q=80&w=2940&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D" + randomImage[1] = "https://images.unsplash.com/photo-1431263154979-0982327fccbb?q=80&w=2670&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D" + randomImage[2] = "https://images.unsplash.com/photo-1516613835066-91cb1a42dda5?q=80&w=2940&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D" + randomImage[3] = "https://images.unsplash.com/photo-1562504979-5aee5dc1cc2c?q=80&w=2940&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D" + randomImage[4] = "https://images.unsplash.com/photo-1606922604118-c1aff542a1a9?q=80&w=2844&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D" var number = Math.floor(Math.random() * randomImage.length) console.log();