mirror of
https://github.com/chsakell/aspnet-core-signalr-angular.git
synced 2025-12-22 17:27:48 +00:00
move FeedEngine to its own class
This commit is contained in:
23
Core/FeedEngine.cs
Normal file
23
Core/FeedEngine.cs
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using LiveGameFeed.Models;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using RecurrentTasks;
|
||||||
|
|
||||||
|
namespace LiveGameFeed.Core
|
||||||
|
{
|
||||||
|
public class FeedEngine : IRunnable
|
||||||
|
{
|
||||||
|
private ILogger logger;
|
||||||
|
|
||||||
|
public FeedEngine(ILogger<FeedEngine> logger)
|
||||||
|
{
|
||||||
|
this.logger = logger;
|
||||||
|
}
|
||||||
|
public void Run(TaskRunStatus taskRunStatus)
|
||||||
|
{
|
||||||
|
var msg = string.Format("Run at: {0}", DateTimeOffset.Now);
|
||||||
|
logger.LogDebug(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using LiveGameFeed.Models;
|
|
||||||
|
|
||||||
namespace LiveGameFeed.Core
|
|
||||||
{
|
|
||||||
public class FeedGenarator
|
|
||||||
{
|
|
||||||
public static Feed UpdateScore(Match match) {
|
|
||||||
Feed feed = new Feed();
|
|
||||||
feed.MatchId = match.Id;
|
|
||||||
|
|
||||||
if(match.Type == MatchTypeEnums.Football)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
else if (match.Type == MatchTypeEnums.Basketball)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return feed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
17
Startup.cs
17
Startup.cs
@@ -15,6 +15,7 @@ using LiveGameFeed.Core.Mappings;
|
|||||||
using LiveGameFeed.Core.MvcTimer;
|
using LiveGameFeed.Core.MvcTimer;
|
||||||
using Newtonsoft.Json.Serialization;
|
using Newtonsoft.Json.Serialization;
|
||||||
using RecurrentTasks;
|
using RecurrentTasks;
|
||||||
|
using LiveGameFeed.Core;
|
||||||
|
|
||||||
namespace LiveGameFeed
|
namespace LiveGameFeed
|
||||||
{
|
{
|
||||||
@@ -92,20 +93,4 @@ namespace LiveGameFeed
|
|||||||
app.StartTask<FeedEngine>(TimeSpan.FromSeconds(15));
|
app.StartTask<FeedEngine>(TimeSpan.FromSeconds(15));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class FeedEngine : IRunnable
|
|
||||||
{
|
|
||||||
private ILogger logger;
|
|
||||||
|
|
||||||
public FeedEngine(ILogger<FeedEngine> logger)
|
|
||||||
{
|
|
||||||
this.logger = logger;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Run(TaskRunStatus taskRunStatus)
|
|
||||||
{
|
|
||||||
var msg = string.Format("Run at: {0}", DateTimeOffset.Now);
|
|
||||||
logger.LogDebug(msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user