some cleanups
This commit is contained in:
@@ -1,14 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Immutable;
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net.Http;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Configuration;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using Tv7Playlist.Core;
|
|
||||||
using Tv7Playlist.Data;
|
using Tv7Playlist.Data;
|
||||||
using Tv7Playlist.Models;
|
using Tv7Playlist.Models;
|
||||||
|
|
||||||
@@ -16,17 +11,14 @@ namespace Tv7Playlist.Controllers
|
|||||||
{
|
{
|
||||||
public class HomeController : Controller
|
public class HomeController : Controller
|
||||||
{
|
{
|
||||||
private readonly ILogger<HomeController> _logger;
|
|
||||||
private readonly IAppConfig _appConfig;
|
|
||||||
private readonly PlaylistContext _playlistContext;
|
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));
|
_playlistContext = playlistContext ?? throw new ArgumentNullException(nameof(playlistContext));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
public async Task<IActionResult> Index()
|
public async Task<IActionResult> Index()
|
||||||
{
|
{
|
||||||
var playlistEntries = await _playlistContext.PlaylistEntries.AsNoTracking().OrderBy(e => e.TrackNumber).ToListAsync();
|
var playlistEntries = await _playlistContext.PlaylistEntries.AsNoTracking().OrderBy(e => e.TrackNumber).ToListAsync();
|
||||||
@@ -35,10 +27,13 @@ namespace Tv7Playlist.Controllers
|
|||||||
return View(model);
|
return View(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||||
public IActionResult Error()
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -6,9 +6,9 @@
|
|||||||
<div class="col col-12">
|
<div class="col col-12">
|
||||||
<table class="table table-hover table-striped">
|
<table class="table table-hover table-striped">
|
||||||
<tr>
|
<tr>
|
||||||
<th>Position</th>
|
|
||||||
<th>Number</th>
|
<th>Number</th>
|
||||||
<th>Number override</th>
|
<th>Number override</th>
|
||||||
|
<th>Position</th>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>Name override</th>
|
<th>Name override</th>
|
||||||
<th>Enabled</th>
|
<th>Enabled</th>
|
||||||
@@ -21,9 +21,9 @@
|
|||||||
foreach (var track in Model.PlaylistEntries)
|
foreach (var track in Model.PlaylistEntries)
|
||||||
{
|
{
|
||||||
<tr>
|
<tr>
|
||||||
<td>@track.Position</td>
|
|
||||||
<td>@track.TrackNumber</td>
|
<td>@track.TrackNumber</td>
|
||||||
<td>@track.TrackNumberOverride</td>
|
<td>@(track.TrackNumberOverride==0?string.Empty:track.TrackNumberOverride.ToString())</td>
|
||||||
|
<td>@track.Position</td>
|
||||||
<td>@track.Name</td>
|
<td>@track.Name</td>
|
||||||
<td>@track.NameOverride</td>
|
<td>@track.NameOverride</td>
|
||||||
<td>@track.IsEnabled</td>
|
<td>@track.IsEnabled</td>
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8"/>
|
<meta charset="utf-8"/>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||||
<title>@ViewData["Title"] - Tv7Playlist</title>
|
<title>@ViewData["Title"]</title>
|
||||||
|
|
||||||
<environment include="Development">
|
<environment include="Development">
|
||||||
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css"/>
|
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css"/>
|
||||||
|
Reference in New Issue
Block a user