diff --git a/NzbDrone.Web/Controllers/SettingsController.cs b/NzbDrone.Web/Controllers/SettingsController.cs index df9c96140..3fa24ca7e 100644 --- a/NzbDrone.Web/Controllers/SettingsController.cs +++ b/NzbDrone.Web/Controllers/SettingsController.cs @@ -300,8 +300,17 @@ public ActionResult SaveQuality(QualityModel data) { _configProvider.SetValue("DefaultQualityProfile", data.DefaultProfileId.ToString()); + foreach (var dbProfile in _qualityProvider.GetAllProfiles().Where(q => q.UserProfile)) + { + if (!data.UserProfiles.Exists(p => p.ProfileId == dbProfile.ProfileId)) + _qualityProvider.Delete(dbProfile.ProfileId); + } + + foreach (var profile in data.UserProfiles) { + Logger.Debug(String.Format("Updating User Profile: {0}", profile)); + profile.Allowed = new List(); foreach (var quality in profile.AllowedString.Split(',')) { @@ -311,7 +320,8 @@ public ActionResult SaveQuality(QualityModel data) //If the Cutoff value selected is not in the allowed list then use the last allowed value, this should be validated on submit if (!profile.Allowed.Contains(profile.Cutoff)) - profile.Cutoff = profile.Allowed.Last(); + throw new InvalidOperationException("Invalid Cutoff Value"); + //profile.Cutoff = profile.Allowed.Last(); if (profile.ProfileId > 0) _qualityProvider.Update(profile); @@ -319,7 +329,6 @@ public ActionResult SaveQuality(QualityModel data) else _qualityProvider.Add(profile); } - } catch (Exception e) diff --git a/NzbDrone.Web/Models/TestModel.cs b/NzbDrone.Web/Models/TestModel.cs new file mode 100644 index 000000000..666e80e4c --- /dev/null +++ b/NzbDrone.Web/Models/TestModel.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace NzbDrone.Web.Models +{ + public class TestModel + { + public int Number { get; set; } + } +} \ No newline at end of file diff --git a/NzbDrone.Web/Views/Home/Test.aspx b/NzbDrone.Web/Views/Home/Test.aspx new file mode 100644 index 000000000..608b60db6 --- /dev/null +++ b/NzbDrone.Web/Views/Home/Test.aspx @@ -0,0 +1,31 @@ +<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %> + + + Test + + + + +

Test

+ + <% using (Html.BeginForm("Test", "Home", FormMethod.Post, new { id = "form", name = "form" })) + {%> + +
One: <%=Html.RadioButtonFor(t => t.Number, 1)%>
+
Two: <%=Html.RadioButtonFor(t => t.Number, 2)%>
+
Three: <%=Html.RadioButtonFor(t => t.Number, 3)%>
+
Four: <%=Html.RadioButtonFor(t => t.Number, 4)%>
+ + + <% } %> + +
+ + + + + + + + + diff --git a/NzbDrone.Web/Views/Settings/UserProfileSection.ascx b/NzbDrone.Web/Views/Settings/UserProfileSection.ascx index 80eaec80e..dc9f5ed5a 100644 --- a/NzbDrone.Web/Views/Settings/UserProfileSection.ascx +++ b/NzbDrone.Web/Views/Settings/UserProfileSection.ascx @@ -5,9 +5,15 @@ <% using (Html.BeginCollectionItem("UserProfiles")) { %>