Skip to content

Commit 36bd3f7

Browse files
committed
Removed news
1 parent a49d348 commit 36bd3f7

File tree

2 files changed

+23
-26
lines changed

2 files changed

+23
-26
lines changed

Fritz.StreamTools/Controllers/GitHubController.cs

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
using Fritz.StreamTools.Models;
2+
using Fritz.StreamTools.Services;
3+
using LazyCache;
24
using Microsoft.AspNetCore.Mvc;
5+
using Microsoft.Extensions.Logging;
36
using Microsoft.Extensions.Options;
7+
using Newtonsoft.Json;
48
using Octokit;
5-
using System.Threading.Tasks;
6-
using System.Linq;
79
using System;
8-
using LazyCache;
9-
using Microsoft.Extensions.Logging;
10-
using Fritz.StreamTools.Services;
1110
using System.Collections.Generic;
12-
using System.Net.Http;
13-
using Newtonsoft.Json;
1411
using System.IO;
12+
using System.Linq;
13+
using System.Net.Http;
14+
using System.Threading.Tasks;
1515

1616
namespace Fritz.StreamTools.Controllers
1717
{
@@ -59,11 +59,10 @@ public async Task<IActionResult> ContributorsInformation(string repo, string use
5959
});
6060
}
6161

62-
var newsPosts = await GetNewsFromDiscoverDotNet();
62+
// var newsPosts = await GetNewsFromDiscoverDotNet();
6363
var outViewModel = new TickerViewModel()
6464
{
65-
GitHubInformation = outModel.ToArray(),
66-
News = newsPosts
65+
GitHubInformation = outModel.ToArray()
6766
};
6867

6968
ViewBag.Configuration = _gitHubConfiguration;
@@ -75,16 +74,12 @@ public async Task<IActionResult> ContributorsInformation(string repo, string use
7574
private async Task<(string source, string color, IEnumerable<BlogPostModel> blogPosts)> GetNewsFromDiscoverDotNet()
7675
{
7776
IList<BlogPostModel> posts;
78-
using(Stream response = await _httpClient.GetStreamAsync("https://discoverdot.net/data/news.json"))
77+
using (Stream response = await _httpClient.GetStreamAsync("https://discoverdot.net/data/news.json"))
7978
{
80-
using(StreamReader reader = new StreamReader(response))
81-
{
82-
using(JsonTextReader json = new JsonTextReader(reader))
83-
{
84-
posts = _serializer.Deserialize<IList<BlogPostModel>>(json);
85-
}
86-
}
87-
}
79+
using StreamReader reader = new StreamReader(response);
80+
using JsonTextReader json = new JsonTextReader(reader);
81+
posts = _serializer.Deserialize<IList<BlogPostModel>>(json);
82+
}
8883
return ("Discover .NET", "#FFCCFF", posts.Take(5).ToArray());
8984
}
9085

@@ -114,7 +109,8 @@ public async Task<IActionResult> GetContributors()
114109
}
115110

116111

117-
public IActionResult Test(int value, string devName, string projectName) {
112+
public IActionResult Test(int value, string devName, string projectName)
113+
{
118114

119115
GitHubService.LastUpdate = DateTime.MinValue;
120116

@@ -129,8 +125,8 @@ public IActionResult Configuration(GitHubConfiguration configuration)
129125
{
130126
if (ModelState.IsValid)
131127
{
132-
_gitHubConfiguration.RepositoryName = configuration.RepositoryName;
133-
_gitHubConfiguration.RepositoryOwner = configuration.RepositoryOwner;
128+
_gitHubConfiguration.RepositoryName = configuration.RepositoryName;
129+
_gitHubConfiguration.RepositoryOwner = configuration.RepositoryOwner;
134130
}
135131

136132
return View(configuration);
@@ -177,7 +173,8 @@ public async Task<IActionResult> VerifyRepository(string repositoryName, string
177173
}
178174
}
179175

180-
public class TickerViewModel {
176+
public class TickerViewModel
177+
{
181178

182179
public IEnumerable<GitHubInformation> GitHubInformation { get; set; }
183180

Fritz.StreamTools/Views/GitHub/Contributor_h-scroll.cshtml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,15 @@
8989
9090
}
9191
92-
<span id="news">
92+
@* <span id="news">
9393
9494
<b style="color: @Model.News.color!important">Latest news from @Model.News.source</b>
9595
96-
@foreach(var article in Model.News.blogPosts) {
96+
foreach(var article in Model.News?.blogPosts) {
9797
<span style="margin-right: 3px; text-decoration: underline;">@article.Title</span>
9898
}
9999
100-
</span>
100+
</span> *@
101101
102102
</p>
103103

0 commit comments

Comments
 (0)