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/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(); 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 1ece7cc..d890f21 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

+
+
@@ -19,9 +21,6 @@ - @@ -34,15 +33,37 @@ - }
@Html.DisplayNameFor(model => model.ListItems[0].Plant.Name) - @Html.DisplayNameFor(model => model.ListItems[0].Location) -
@Html.DisplayFor(modelItem => item.Plant.Name) - @Html.DisplayFor(modelItem => item.Location.Id) - Edit | - Details | + Details | Delete
+

+ Search for more! +

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

List is Empty!

+
+
+ +

+ Search for Plants! +

+ + Return to My Lists! + } + + \ No newline at end of file diff --git a/Pages/Lists/Create.cshtml b/Pages/Lists/Create.cshtml index 0b66286..b55f6a8 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

+
+
-
+
@@ -23,7 +24,7 @@
-
+
@@ -33,7 +34,7 @@
- +
@@ -41,3 +42,9 @@ @section Scripts { @{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/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..b45750a 100644 --- a/Pages/Lists/Edit.cshtml +++ b/Pages/Lists/Edit.cshtml @@ -5,9 +5,11 @@ ViewData["Title"] = "Edit"; } -

Edit

+
+
+

Edit List

+
-

Lists


@@ -19,7 +21,7 @@
-
+
@@ -30,7 +32,7 @@
- +
@@ -38,3 +40,9 @@ @section Scripts { @{await Html.RenderPartialAsync("_ValidationScriptsPartial");} } + +