1
1
using Fritz . StreamTools . Models ;
2
+ using Fritz . StreamTools . Services ;
3
+ using LazyCache ;
2
4
using Microsoft . AspNetCore . Mvc ;
5
+ using Microsoft . Extensions . Logging ;
3
6
using Microsoft . Extensions . Options ;
7
+ using Newtonsoft . Json ;
4
8
using Octokit ;
5
- using System . Threading . Tasks ;
6
- using System . Linq ;
7
9
using System ;
8
- using LazyCache ;
9
- using Microsoft . Extensions . Logging ;
10
- using Fritz . StreamTools . Services ;
11
10
using System . Collections . Generic ;
12
- using System . Net . Http ;
13
- using Newtonsoft . Json ;
14
11
using System . IO ;
12
+ using System . Linq ;
13
+ using System . Net . Http ;
14
+ using System . Threading . Tasks ;
15
15
16
16
namespace Fritz . StreamTools . Controllers
17
17
{
@@ -59,11 +59,10 @@ public async Task<IActionResult> ContributorsInformation(string repo, string use
59
59
} ) ;
60
60
}
61
61
62
- var newsPosts = await GetNewsFromDiscoverDotNet ( ) ;
62
+ // var newsPosts = await GetNewsFromDiscoverDotNet();
63
63
var outViewModel = new TickerViewModel ( )
64
64
{
65
- GitHubInformation = outModel . ToArray ( ) ,
66
- News = newsPosts
65
+ GitHubInformation = outModel . ToArray ( )
67
66
} ;
68
67
69
68
ViewBag . Configuration = _gitHubConfiguration ;
@@ -75,16 +74,12 @@ public async Task<IActionResult> ContributorsInformation(string repo, string use
75
74
private async Task < ( string source , string color , IEnumerable < BlogPostModel > blogPosts ) > GetNewsFromDiscoverDotNet ( )
76
75
{
77
76
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" ) )
79
78
{
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
+ }
88
83
return ( "Discover .NET" , "#FFCCFF" , posts . Take ( 5 ) . ToArray ( ) ) ;
89
84
}
90
85
@@ -114,7 +109,8 @@ public async Task<IActionResult> GetContributors()
114
109
}
115
110
116
111
117
- public IActionResult Test ( int value , string devName , string projectName ) {
112
+ public IActionResult Test ( int value , string devName , string projectName )
113
+ {
118
114
119
115
GitHubService . LastUpdate = DateTime . MinValue ;
120
116
@@ -129,8 +125,8 @@ public IActionResult Configuration(GitHubConfiguration configuration)
129
125
{
130
126
if ( ModelState . IsValid )
131
127
{
132
- _gitHubConfiguration . RepositoryName = configuration . RepositoryName ;
133
- _gitHubConfiguration . RepositoryOwner = configuration . RepositoryOwner ;
128
+ _gitHubConfiguration . RepositoryName = configuration . RepositoryName ;
129
+ _gitHubConfiguration . RepositoryOwner = configuration . RepositoryOwner ;
134
130
}
135
131
136
132
return View ( configuration ) ;
@@ -177,7 +173,8 @@ public async Task<IActionResult> VerifyRepository(string repositoryName, string
177
173
}
178
174
}
179
175
180
- public class TickerViewModel {
176
+ public class TickerViewModel
177
+ {
181
178
182
179
public IEnumerable < GitHubInformation > GitHubInformation { get ; set ; }
183
180
0 commit comments