This repository has been archived by the owner on Apr 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
50 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
NewsletterCurator.Web/Models/CategoryNewsItemsViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using System.Collections.Generic; | ||
using NewsletterCurator.Data; | ||
|
||
namespace NewsletterCurator.Web.Models | ||
{ | ||
public class CategoryNewsItemsViewModel | ||
{ | ||
public Category Category { get; set; } | ||
|
||
public List<Newsitem> Newsitems { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,34 @@ | ||
@model List<Category> | ||
@model List<CategoryNewsItemsViewModel> | ||
|
||
<div class="container"> | ||
<h1>Newsletter Curator</h1> | ||
<ul> | ||
@foreach (var category in Model) | ||
{ | ||
<li>@category.ID - @category.Name</li> | ||
} | ||
</ul> | ||
@foreach (var categoryNewsItemsViewModel in Model) | ||
{ | ||
<h1>@categoryNewsItemsViewModel.Category.Name</h1> | ||
<table class="table-striped table-bordered table-hover"> | ||
<thead> | ||
<tr> | ||
<th width="5%" scope="col"></th> | ||
<th width="15%" scope="col">Title</th> | ||
<th width="80%" scope="col">Summary</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
@foreach (var newsItem in categoryNewsItemsViewModel.Newsitems) | ||
{ | ||
<tr> | ||
<td><input type="checkbox" /></td> | ||
<td>@newsItem.Title</td> | ||
<td>@newsItem.Summary</td> | ||
</tr> | ||
} | ||
</tbody> | ||
</table> | ||
} | ||
|
||
<a href="javascript: document.location='@Url.AbsoluteAction("Add", "Newsitem")?url=' + encodeURIComponent(document.location)">Add to Newsletter</a> | ||
|
||
<form method="get" asp-action="Add" asp-controller="Newsitem"> | ||
<input type="url" name="url" placeholder="URL" /> | ||
<input type="submit" value="Submit"/> | ||
</form> | ||
</div> |