First running edit version
This commit is contained in:
@@ -4,6 +4,7 @@ using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Tv7Playlist.Core;
|
||||
using Tv7Playlist.Data;
|
||||
using Tv7Playlist.Models;
|
||||
|
||||
@@ -12,10 +13,12 @@ namespace Tv7Playlist.Controllers
|
||||
public class HomeController : Controller
|
||||
{
|
||||
private readonly PlaylistContext _playlistContext;
|
||||
private readonly IPlaylistSynchronizer _playlistSynchronizer;
|
||||
|
||||
public HomeController(PlaylistContext playlistContext)
|
||||
public HomeController(PlaylistContext playlistContext, IPlaylistSynchronizer playlistSynchronizer)
|
||||
{
|
||||
_playlistContext = playlistContext ?? throw new ArgumentNullException(nameof(playlistContext));
|
||||
_playlistSynchronizer = playlistSynchronizer ?? throw new ArgumentNullException(nameof(playlistSynchronizer));
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
@@ -35,5 +38,14 @@ namespace Tv7Playlist.Controllers
|
||||
|
||||
return View(errorViewModel);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("synchronize")]
|
||||
public async Task<IActionResult> Synchronize()
|
||||
{
|
||||
await _playlistSynchronizer.SynchronizeAsync();
|
||||
|
||||
return RedirectToAction("Index", "Home");
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user