From b404bdb0d5b5fdf44e60584888df33ac4f51d3cb Mon Sep 17 00:00:00 2001
From: Pj Metz <65838556+MetzinAround@users.noreply.github.com>
Date: Sun, 2 Aug 2020 12:57:39 -0400
Subject: [PATCH] Css, Author Picutres, USing List and LINQ for poem info
Lots of changes here!
---
.../.config/dotnet-tools.json | 12 +++
.../Constants/PoetsConstants.cs | 30 ++++++
Your New Favorite Poem/Models/Products.cs | 9 +-
Your New Favorite Poem/Pages/Index.cshtml | 101 +++++++++++++-----
Your New Favorite Poem/Pages/Index.cshtml.cs | 20 ++--
Your New Favorite Poem/Pages/Poets.cshtml | 15 ++-
.../Pages/Shared/_Layout.cshtml | 3 -
.../Your New Favorite Poem.csproj | 12 ++-
Your New Favorite Poem/wwwroot/css/site.css | 26 ++++-
9 files changed, 173 insertions(+), 55 deletions(-)
create mode 100644 Your New Favorite Poem/.config/dotnet-tools.json
create mode 100644 Your New Favorite Poem/Constants/PoetsConstants.cs
diff --git a/Your New Favorite Poem/.config/dotnet-tools.json b/Your New Favorite Poem/.config/dotnet-tools.json
new file mode 100644
index 0000000..4947a30
--- /dev/null
+++ b/Your New Favorite Poem/.config/dotnet-tools.json
@@ -0,0 +1,12 @@
+{
+ "version": 1,
+ "isRoot": true,
+ "tools": {
+ "dotnet-ef": {
+ "version": "3.1.6",
+ "commands": [
+ "dotnet-ef"
+ ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/Your New Favorite Poem/Constants/PoetsConstants.cs b/Your New Favorite Poem/Constants/PoetsConstants.cs
new file mode 100644
index 0000000..0aaf811
--- /dev/null
+++ b/Your New Favorite Poem/Constants/PoetsConstants.cs
@@ -0,0 +1,30 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Your_New_Favorite_Poem.Models;
+
+namespace Your_New_Favorite_Poem.Constants
+{
+ public static class PoetsConstants
+ {
+ public static IReadOnlyList PoemList { get; } = new List
+ {
+ new Poem {Author = "Ocean Vuong", Title = "One Day I'll Love Ocean Vuong", URL = new Uri ("https://www.poetryinvoice.com/poems/someday-ill-love-ocean-vuong")},
+ new Poem {Author = "Ocean Vuong", Title = "Untitled (Blue, Green, & Brown)", URL = new Uri ("https://www.triquarterly.org/issues/issue-146/untitled-blue-green-brown-oil-canvas-mark-rothko-1952")},
+ new Poem {Author = "Mary Oliver", Title = "The Summer Day", URL = new Uri ("https://wordsfortheyear.com/2015/06/21/the-summer-day-by-mary-oliver/")},
+ new Poem {Author = "Mary Oliver", Title = "Wild Geese", URL = new Uri ("http://www.phys.unm.edu/~tw/fas/yits/archive/oliver_wildgeese.html")},
+ new Poem {Author = "Layli Long Soldier", Title = "38", URL = new Uri ("https://onbeing.org/poetry/38/")},
+ new Poem {Author = "Layli Long Soldier", Title = "Obligations 2", URL = new Uri ("https://www.poetryfoundation.org/poems/149976/obligations-2")},
+ new Poem {Author = "Terrance Hayes", Title = "I lock you in an American sonnet that is part prison", URL = new Uri ("https://www.poetryfoundation.org/poetrymagazine/poems/143917/american-sonnet-for-my-past-and-future-assassin-598dc83c976f1")},
+ new Poem {Author = "Terrance Hayes", Title = "Probably, Ghosts Are Allergic To Us. Our Uproarious", URL = new Uri ("https://rhymings.com/terrance-hayes/probably-ghosts-are-allergic-to-us-our-uproarious/")},
+ new Poem {Author = "Shay Alexi", Title = "John Mayer's 'Your Body is a Wonderland'is Kinda Gross But", URL = new Uri ("http://www.glass-poetry.com/journal/2018/may/alexi-john.html")},
+ new Poem {Author = "Shay Alexi", Title = "OUR MOTHER IS A NIGHTWITCH OR AN ODE TO FEMME FRIENDSHIP", URL = new Uri ("https://tinderboxpoetry.com/our-mother-is-a-nightwitch-or-an-ode-to-femme-friendship")},
+ new Poem {Author = "Marci Calabretta Cancio-Bello", Title = "In the Animal Garden of My Body", URL = new Uri ("https://poets.org/poem/animal-garden-my-body")},
+ new Poem {Author = "Marci Calabretta Cancio-Bello", Title = "Vase of Ashes", URL = new Uri ("https://www.tupeloquarterly.com/vase-of-ashes-by-marci-calabretta-cancio-bello/")},
+ new Poem {Author = "Martín Espada", Title = "Flowers and Bullets", URL = new Uri ("https://poets.org/poem/flowers-and-bullets")},
+ new Poem {Author = "Martín Espada", Title = "How We Could Have Lived or Died This Way", URL = new Uri ("https://poets.org/poem/how-we-could-have-lived-or-died-way")}
+
+ };
+ }
+}
diff --git a/Your New Favorite Poem/Models/Products.cs b/Your New Favorite Poem/Models/Products.cs
index 9ca48a6..a2bc985 100644
--- a/Your New Favorite Poem/Models/Products.cs
+++ b/Your New Favorite Poem/Models/Products.cs
@@ -5,11 +5,12 @@
namespace Your_New_Favorite_Poem.Models
{
- internal class Products
+ public class Poem
{
- public string Name { get; set; }
- public string Country { get; set; }
- public string Poems { get; set; }
+ public string Author { get; set; }
+ public string Title { get; set; }
+ public Uri URL { get; set; }
}
+
}
diff --git a/Your New Favorite Poem/Pages/Index.cshtml b/Your New Favorite Poem/Pages/Index.cshtml
index 6cb9a1d..78b3212 100644
--- a/Your New Favorite Poem/Pages/Index.cshtml
+++ b/Your New Favorite Poem/Pages/Index.cshtml
@@ -6,6 +6,7 @@
Your New Favorite Poem
+
@@ -16,91 +17,135 @@
This website is a place to discover new poets, the type of poets you wouldn't necessarily find in your English class.
They're worthy of a look and especially worthy of supporting.
+
+
+
+
+
\ No newline at end of file
diff --git a/Your New Favorite Poem/Pages/Index.cshtml.cs b/Your New Favorite Poem/Pages/Index.cshtml.cs
index 3683cf7..c0cb580 100644
--- a/Your New Favorite Poem/Pages/Index.cshtml.cs
+++ b/Your New Favorite Poem/Pages/Index.cshtml.cs
@@ -2,24 +2,32 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
+using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;
+using Your_New_Favorite_Poem.Constants;
+using Your_New_Favorite_Poem.Models;
namespace Your_New_Favorite_Poem.Pages
{
public class IndexModel : PageModel
{
+
+ public IActionResult OnPostRandomPoem()
+ {
+ var rnd = new Random();
+ var index = rnd.Next(0, PoetsConstants.PoemList.Count);
+
+ var randomPoem = PoetsConstants.PoemList[index];
+
+ return Redirect(randomPoem.URL.ToString());
+ }
private readonly ILogger _logger;
public IndexModel(ILogger logger)
{
_logger = logger;
}
-
- public void OnGet()
- {
-
- }
}
-}
+}
diff --git a/Your New Favorite Poem/Pages/Poets.cshtml b/Your New Favorite Poem/Pages/Poets.cshtml
index 9621968..8e17efc 100644
--- a/Your New Favorite Poem/Pages/Poets.cshtml
+++ b/Your New Favorite Poem/Pages/Poets.cshtml
@@ -5,16 +5,15 @@
}
Poets
-
This page is a work in progress! Come back later!
+
List of all currently featured poets on the page!
diff --git a/Your New Favorite Poem/Pages/Shared/_Layout.cshtml b/Your New Favorite Poem/Pages/Shared/_Layout.cshtml
index cdfb2b5..8d34b5e 100644
--- a/Your New Favorite Poem/Pages/Shared/_Layout.cshtml
+++ b/Your New Favorite Poem/Pages/Shared/_Layout.cshtml
@@ -21,9 +21,6 @@