From 4000387419fd9e91f9d92c8fb306b2ea9e9ce5cf Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Thu, 31 Mar 2011 00:06:13 -0700 Subject: [PATCH] fixed ajax call for add existing --- NzbDrone.Web/Controllers/SeriesController.cs | 22 +++------ NzbDrone.Web/Views/Series/AddExisting.aspx | 47 +++++++++++--------- 2 files changed, 32 insertions(+), 37 deletions(-) diff --git a/NzbDrone.Web/Controllers/SeriesController.cs b/NzbDrone.Web/Controllers/SeriesController.cs index c98228cc5..56c84544f 100644 --- a/NzbDrone.Web/Controllers/SeriesController.cs +++ b/NzbDrone.Web/Controllers/SeriesController.cs @@ -187,28 +187,16 @@ namespace NzbDrone.Web.Controllers return View(new GridModel(unmappedList)); } - public ActionResult SyncSelectedSeries(List checkedRecords) + public ActionResult SyncSelectedSeries(string path, int tvdbId, int qualityProfileId) { var unmappedList = new List(); - foreach (var checkedRecord in checkedRecords) - { - NameValueCollection nvc = HttpUtility.ParseQueryString(checkedRecord); - - var path = HttpUtility.UrlDecode(nvc["path"]); - var tvDbId = Convert.ToInt32(HttpUtility.UrlDecode(nvc["tvdbid"])); - var qualityProfileId = Convert.ToInt32(HttpUtility.UrlDecode(nvc["qualityProfileId"])); - - //If the TvDbId for this show is 0 then skip it... User made a mistake... They will have to manually map it - if (tvDbId < 1) continue; - - unmappedList.Add(new SeriesMappingModel { Path = path, TvDbId = tvDbId, QualityProfileId = qualityProfileId }); - } + //If the TvDbId for this show is 0 then skip it... User made a mistake... They will have to manually map it + if (tvdbId < 1) throw new ArgumentException("Invalid tvdb id", "tvdbId"); - if (_syncProvider.BeginSyncUnmappedFolders(unmappedList)) - return Content("Sync Started for Selected Series"); + unmappedList.Add(new SeriesMappingModel { Path = path, TvDbId = tvdbId, QualityProfileId = qualityProfileId }); - return Content("Sync already in progress, please wait for it to complete before retrying."); + return Content("Ok"); } public ActionResult AddNewSeries(string dir, int seriesId, string seriesName, int qualityProfileId) diff --git a/NzbDrone.Web/Views/Series/AddExisting.aspx b/NzbDrone.Web/Views/Series/AddExisting.aspx index b39133a17..4852f8c75 100644 --- a/NzbDrone.Web/Views/Series/AddExisting.aspx +++ b/NzbDrone.Web/Views/Series/AddExisting.aspx @@ -2,7 +2,6 @@ <%@ Import Namespace="Telerik.Web.Mvc.UI" %> <%@ Import Namespace="NzbDrone.Web.Models" %> - Add Existing Series @@ -12,7 +11,6 @@ %> - - - <%= Html.Label("Quality Profile")%> - <%: Html.DropDownList("qualityProfileId", (SelectList)ViewData["QualitySelectList"], ViewData["QualityProfileId"])%> - -