fixed show grid, added details page

pull/2/head
kay.one 14 years ago
parent 772452aa8b
commit 4d4a8198eb

@ -6,6 +6,7 @@ namespace NzbDrone.Core.Controllers
public interface ISeriesController public interface ISeriesController
{ {
IQueryable<Series> GetSeries(); IQueryable<Series> GetSeries();
Series GetSeries(int tvdbId);
void SyncSeriesWithDisk(); void SyncSeriesWithDisk();
} }
} }

@ -32,16 +32,23 @@ namespace NzbDrone.Core.Controllers
return _sonioRepo.All<Series>(); return _sonioRepo.All<Series>();
} }
public Series GetSeries(int tvdbId)
{
return _sonioRepo.Single<Series>(s=> s.TvdbId == tvdbId);
}
public void SyncSeriesWithDisk() public void SyncSeriesWithDisk()
{ {
foreach (string seriesFolder in _diskController.GetDirectories(_config.SeriesRoot)) foreach (string seriesFolder in _diskController.GetDirectories(_config.SeriesRoot))
{ {
var dirInfo = new DirectoryInfo(seriesFolder); var cleanPath =_diskController.CleanPath(new DirectoryInfo(seriesFolder).FullName);
if (!_sonioRepo.Exists<Series>(s => s.Path == _diskController.CleanPath(dirInfo.FullName))) if (!_sonioRepo.Exists<Series>(s => s.Path == cleanPath))
{ {
_logger.InfoFormat("Folder '{0} isn't mapped to a series in the database. Trying to map it.'", seriesFolder); _logger.InfoFormat("Folder '{0} isn't mapped to a series in the database. Trying to map it.'", cleanPath);
AddShow(seriesFolder); AddShow(cleanPath);
} }
} }
@ -60,7 +67,7 @@ namespace NzbDrone.Core.Controllers
private void AddShow(string path, TvdbSeries series) private void AddShow(string path, TvdbSeries series)
{ {
_sonioRepo.Add(new Series { Id = series.Id, SeriesName = series.SeriesName, AirTimes = series.AirsTime, AirsDayOfWeek = series.AirsDayOfWeek, Overview = series.Overview, Status = series.Status, Language = series.Language.Name, Path = path }); _sonioRepo.Add(new Series { TvdbId = series.Id, SeriesName = series.SeriesName, AirTimes = series.AirsTime, AirsDayOfWeek = series.AirsDayOfWeek, Overview = series.Overview, Status = series.Status, Language = series.Language.Abbriviation, Path = path });
} }
} }
} }

@ -1,10 +1,12 @@
using System; using System;
using SubSonic.SqlGeneration.Schema;
namespace NzbDrone.Core.Repository namespace NzbDrone.Core.Repository
{ {
public class Series public class Series
{ {
public int Id [SubSonicPrimaryKey]
public int TvdbId
{ {
get; get;
set; set;
@ -22,6 +24,7 @@ namespace NzbDrone.Core.Repository
set; set;
} }
[SubSonicLongString]
public string Overview public string Overview
{ {
get; get;
@ -51,5 +54,6 @@ namespace NzbDrone.Core.Repository
get; get;
set; set;
} }
} }
} }

Binary file not shown.

Binary file not shown.

@ -35,9 +35,9 @@ namespace NzbDrone.Web.Controllers
// //
// GET: /Series/Details/5 // GET: /Series/Details/5
public ActionResult Details(int id) public ActionResult Details(int tvdbId)
{ {
return View(); return View(_seriesController.GetSeries(tvdbId));
} }
// //

@ -30,9 +30,10 @@ namespace NzbDrone.Web.Controllers
if (ModelState.IsValid) if (ModelState.IsValid)
{ {
_configController.SeriesRoot = model.TvFolder; _configController.SeriesRoot = model.TvFolder;
//return RedirectToAction("index");
} }
return RedirectToAction("index"); return View(model);
} }
} }

@ -81,6 +81,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="Global.asax" /> <Content Include="Global.asax" />
<Content Include="Views\Series\Details.aspx" />
<Content Include="Views\Series\index.aspx" /> <Content Include="Views\Series\index.aspx" />
<Content Include="Views\Settings\Index.aspx" /> <Content Include="Views\Settings\Index.aspx" />
<Content Include="Web.config"> <Content Include="Web.config">

@ -0,0 +1,45 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<NzbDrone.Core.Repository.Series>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Details
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<h2>Details</h2>
<fieldset>
<legend>Fields</legend>
<div class="display-label">Id</div>
<div class="display-field"><%: Model.TvdbId %></div>
<div class="display-label">SeriesName</div>
<div class="display-field"><%: Model.SeriesName %></div>
<div class="display-label">Status</div>
<div class="display-field"><%: Model.Status %></div>
<div class="display-label">Overview</div>
<div class="display-field"><%: Model.Overview %></div>
<div class="display-label">AirTimes</div>
<div class="display-field"><%: Model.AirTimes %></div>
<div class="display-label">Language</div>
<div class="display-field"><%: Model.Language %></div>
<div class="display-label">Path</div>
<div class="display-field"><%: Model.Path %></div>
<div class="display-label">TvdbId</div>
<div class="display-field"><%: Model.TvdbId %></div>
</fieldset>
<p>
<%-- <%: Html.ActionLink("Edit", "Edit", new { /* id=Model.PrimaryKey */ }) %> |--%>
<%: Html.ActionLink("Back to List", "Index") %>
</p>
</asp:Content>

@ -3,14 +3,11 @@
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"> <asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
SeriesView SeriesView
</asp:Content> </asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<h2>
<h2>SeriesView</h2> SeriesView</h2>
<table> <table>
<tr> <tr>
<th></th>
<th> <th>
Id Id
</th> </th>
@ -20,58 +17,35 @@
<th> <th>
Status Status
</th> </th>
<th>
Overview
</th>
<th>
AirTimes
</th>
<th>
Language
</th>
<th> <th>
Path Path
</th> </th>
</tr> </tr>
<% foreach (var item in Model)
<% foreach (var item in Model) { %> { %>
<tr> <tr>
<%-- <td>
<%: Html.ActionLink("Details", "Details", new { item.TvdbId })%>
|
<%: Html.ActionLink("Delete", "Delete", new { item.TvdbId })%>
</td>--%>
<td> <td>
<%: Html.ActionLink("Edit", "Edit", new { /* id=item.PrimaryKey */ }) %> | <%: item.TvdbId.ToString()%>
<%: Html.ActionLink("Details", "Details", new { /* id=item.PrimaryKey */ })%> |
<%: Html.ActionLink("Delete", "Delete", new { /* id=item.PrimaryKey */ })%>
</td>
<td>
<%: item.Id %>
</td> </td>
<td> <td>
<%: item.SeriesName %> <%: Html.ActionLink(item.SeriesName, "Details", new { item.TvdbId })%>
</td> </td>
<td> <td>
<%: item.Status %> <%: item.Status %>
</td> </td>
<td>
<%: item.Overview %>
</td>
<td>
<%: item.AirTimes %>
</td>
<td>
<%: item.Language %>
</td>
<td> <td>
<%: item.Path %> <%: item.Path %>
</td> </td>
</tr> </tr>
<% } %> <% } %>
</table> </table>
<p> <p>
<%: Html.ActionLink("Create New", "Create") %> <%: Html.ActionLink("Create New", "Create") %>
<%: Html.ActionLink("Sync With Disk", "Sync") %>
</p> </p>
</asp:Content> </asp:Content>

@ -9,7 +9,7 @@
Settings</h2> Settings</h2>
<% using (Html.BeginForm()) <% using (Html.BeginForm())
{ %> { %>
<%: Html.ValidationSummary(true, "Unable to save you settings. Please correct the errors and try again.") %> <%: Html.ValidationSummary(true, "Unable to save your settings. Please correct the errors and try again.") %>
<div> <div>
<fieldset> <fieldset>
<legend>General</legend> <legend>General</legend>

@ -12,7 +12,7 @@
<div id="header"> <div id="header">
<div id="title"> <div id="title">
<h1>[Sponge bob]</h1> <h1>NZBDrone</h1>
</div> </div>
<div id="logindisplay"> <div id="logindisplay">

@ -24,7 +24,9 @@
<add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/></assemblies> <add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="NzbDrone.Core"/>
</assemblies>
</compilation> </compilation>
<!-- <!--
The <authentication> section enables configuration The <authentication> section enables configuration
@ -73,6 +75,7 @@
<add namespace="System.Web.Routing"/> <add namespace="System.Web.Routing"/>
<add namespace="System.Linq"/> <add namespace="System.Linq"/>
<add namespace="System.Collections.Generic"/> <add namespace="System.Collections.Generic"/>
<add namespace="NzbDrone.Core.Repository"/>
</namespaces> </namespaces>
</pages> </pages>
</system.web> </system.web>

Loading…
Cancel
Save