some cleanups

This commit is contained in:
2019-01-25 23:39:09 +01:00
parent 8d04684c95
commit 395faeb4b8
3 changed files with 11 additions and 16 deletions

View File

@@ -1,14 +1,9 @@
using System;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Tv7Playlist.Core;
using Tv7Playlist.Data;
using Tv7Playlist.Models;
@@ -16,17 +11,14 @@ namespace Tv7Playlist.Controllers
{
public class HomeController : Controller
{
private readonly ILogger<HomeController> _logger;
private readonly IAppConfig _appConfig;
private readonly PlaylistContext _playlistContext;
public HomeController(ILogger<HomeController> logger, IAppConfig appConfig, PlaylistContext playlistContext)
public HomeController(PlaylistContext playlistContext)
{
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
_appConfig = appConfig ?? throw new ArgumentNullException(nameof(appConfig));
_playlistContext = playlistContext ?? throw new ArgumentNullException(nameof(playlistContext));
}
[HttpGet]
public async Task<IActionResult> Index()
{
var playlistEntries = await _playlistContext.PlaylistEntries.AsNoTracking().OrderBy(e => e.TrackNumber).ToListAsync();
@@ -35,10 +27,13 @@ namespace Tv7Playlist.Controllers
return View(model);
}
[HttpGet]
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()
{
return View(new ErrorViewModel {RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier});
var errorViewModel = new ErrorViewModel {RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier};
return View(errorViewModel);
}
}
}
}