From 16df0a199a2f7b750148e8c1e2f53aec38b669cc Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Sun, 12 Feb 2017 22:20:57 +0100 Subject: [PATCH] refactoring --- Yavsc/ApiControllers/DjProfileApiController.cs | 2 +- .../MusicalPreferencesApiController.cs | 2 +- .../MusicalTendenciesApiController.cs | 2 +- Yavsc/Controllers/ColorsController.cs | 16 ++++++++-------- Yavsc/Controllers/InstrumentationController.cs | 2 +- Yavsc/Controllers/InstrumentsController.cs | 2 +- .../Controllers/MusicalTendenciesController.cs | 2 +- Yavsc/Models/ApplicationDbContext.cs | 4 ++-- .../Models/{Booking => Musical}/Instrument.cs | 2 +- .../{Booking => Musical}/InstrumentRating.cs | 2 +- .../{Booking => Musical}/MusicalPreference.cs | 2 +- .../{Booking => Musical}/MusicalTendency.cs | 2 +- .../Profiles/DjPerformerProfile.cs | 2 +- .../Profiles/DjSettings.cs | 2 +- .../Profiles/FormationPerformerProfile.cs | 2 +- .../Profiles/GeneralSettings.cs | 2 +- .../Profiles/Instrumentation.cs | 2 +- .../Profiles/MusicianPerformerProfile.cs | 2 +- .../Profiles/StarPerformerProfile.cs | 2 +- Yavsc/Views/Colors/Create.cshtml | 1 - Yavsc/Views/Colors/Delete.cshtml | 2 ++ Yavsc/Views/Colors/Details.cshtml | 4 ++-- Yavsc/Views/Colors/Edit.cshtml | 9 +++++++++ Yavsc/Views/Colors/Index.cshtml | 6 +++--- Yavsc/Views/Shared/ColorEditor.cshtml | 18 +++++++++++++++++- Yavsc/Views/Shared/_Layout.cshtml | 5 ++--- 26 files changed, 62 insertions(+), 37 deletions(-) rename Yavsc/Models/{Booking => Musical}/Instrument.cs (91%) rename Yavsc/Models/{Booking => Musical}/InstrumentRating.cs (94%) rename Yavsc/Models/{Booking => Musical}/MusicalPreference.cs (89%) rename Yavsc/Models/{Booking => Musical}/MusicalTendency.cs (90%) rename Yavsc/Models/{Booking => Musical}/Profiles/DjPerformerProfile.cs (92%) rename Yavsc/Models/{Booking => Musical}/Profiles/DjSettings.cs (90%) rename Yavsc/Models/{Booking => Musical}/Profiles/FormationPerformerProfile.cs (87%) rename Yavsc/Models/{Booking => Musical}/Profiles/GeneralSettings.cs (89%) rename Yavsc/Models/{Booking => Musical}/Profiles/Instrumentation.cs (92%) rename Yavsc/Models/{Booking => Musical}/Profiles/MusicianPerformerProfile.cs (91%) rename Yavsc/Models/{Booking => Musical}/Profiles/StarPerformerProfile.cs (88%) diff --git a/Yavsc/ApiControllers/DjProfileApiController.cs b/Yavsc/ApiControllers/DjProfileApiController.cs index 92b95e780..28559844f 100644 --- a/Yavsc/ApiControllers/DjProfileApiController.cs +++ b/Yavsc/ApiControllers/DjProfileApiController.cs @@ -1,7 +1,7 @@ namespace Yavsc.ApiControllers { using Models; - using Models.Booking.Profiles; + using Models.Musical.Profiles; public class DjProfileApiController : ProfileApiController { diff --git a/Yavsc/ApiControllers/MusicalPreferencesApiController.cs b/Yavsc/ApiControllers/MusicalPreferencesApiController.cs index 60c3a5b37..35bf5f080 100644 --- a/Yavsc/ApiControllers/MusicalPreferencesApiController.cs +++ b/Yavsc/ApiControllers/MusicalPreferencesApiController.cs @@ -4,7 +4,7 @@ using Microsoft.AspNet.Http; using Microsoft.AspNet.Mvc; using Microsoft.Data.Entity; using Yavsc.Models; -using Yavsc.Models.Booking; +using Yavsc.Models.Musical; namespace Yavsc.Controllers { diff --git a/Yavsc/ApiControllers/MusicalTendenciesApiController.cs b/Yavsc/ApiControllers/MusicalTendenciesApiController.cs index 701c84903..9dcb81d1d 100644 --- a/Yavsc/ApiControllers/MusicalTendenciesApiController.cs +++ b/Yavsc/ApiControllers/MusicalTendenciesApiController.cs @@ -4,7 +4,7 @@ using Microsoft.AspNet.Http; using Microsoft.AspNet.Mvc; using Microsoft.Data.Entity; using Yavsc.Models; -using Yavsc.Models.Booking; +using Yavsc.Models.Musical; namespace Yavsc.Controllers { diff --git a/Yavsc/Controllers/ColorsController.cs b/Yavsc/Controllers/ColorsController.cs index f4a0f4670..e92d79017 100644 --- a/Yavsc/Controllers/ColorsController.cs +++ b/Yavsc/Controllers/ColorsController.cs @@ -24,14 +24,14 @@ namespace Yavsc.Controllers } // GET: Colors/Details/5 - public async Task Details(byte? id) + public async Task Details(long? id) { if (id == null) { return HttpNotFound(); } - Color color = await _context.Color.SingleAsync(m => m.Red == id); + Color color = await _context.Color.SingleAsync(m => m.Id == id); if (color == null) { return HttpNotFound(); @@ -61,14 +61,14 @@ namespace Yavsc.Controllers } // GET: Colors/Edit/5 - public async Task Edit(byte? id) + public async Task Edit(long? id) { if (id == null) { return HttpNotFound(); } - Color color = await _context.Color.SingleAsync(m => m.Red == id); + Color color = await _context.Color.SingleAsync(m => m.Id == id); if (color == null) { return HttpNotFound(); @@ -92,14 +92,14 @@ namespace Yavsc.Controllers // GET: Colors/Delete/5 [ActionName("Delete")] - public async Task Delete(byte? id) + public async Task Delete(long? id) { if (id == null) { return HttpNotFound(); } - Color color = await _context.Color.SingleAsync(m => m.Red == id); + Color color = await _context.Color.SingleAsync(m => m.Id == id); if (color == null) { return HttpNotFound(); @@ -111,9 +111,9 @@ namespace Yavsc.Controllers // POST: Colors/Delete/5 [HttpPost, ActionName("Delete")] [ValidateAntiForgeryToken] - public async Task DeleteConfirmed(byte id) + public async Task DeleteConfirmed(long id) { - Color color = await _context.Color.SingleAsync(m => m.Red == id); + Color color = await _context.Color.SingleAsync(m => m.Id == id); _context.Color.Remove(color); await _context.SaveChangesAsync(); return RedirectToAction("Index"); diff --git a/Yavsc/Controllers/InstrumentationController.cs b/Yavsc/Controllers/InstrumentationController.cs index c7f2ccd10..e9e7a2c50 100644 --- a/Yavsc/Controllers/InstrumentationController.cs +++ b/Yavsc/Controllers/InstrumentationController.cs @@ -6,7 +6,7 @@ using Microsoft.AspNet.Mvc; using Microsoft.AspNet.Mvc.Rendering; using Microsoft.Data.Entity; using Yavsc.Models; -using Yavsc.Models.Booking.Profiles; +using Yavsc.Models.Musical.Profiles; namespace Yavsc.Controllers { diff --git a/Yavsc/Controllers/InstrumentsController.cs b/Yavsc/Controllers/InstrumentsController.cs index b63ce9d94..4ad6b7788 100644 --- a/Yavsc/Controllers/InstrumentsController.cs +++ b/Yavsc/Controllers/InstrumentsController.cs @@ -4,7 +4,7 @@ using Microsoft.AspNet.Mvc; namespace Yavsc.Controllers { using Models; - using Models.Booking; + using Models.Musical; public class InstrumentsController : Controller { private ApplicationDbContext _context; diff --git a/Yavsc/Controllers/MusicalTendenciesController.cs b/Yavsc/Controllers/MusicalTendenciesController.cs index 61d7c5e40..df35e49e2 100644 --- a/Yavsc/Controllers/MusicalTendenciesController.cs +++ b/Yavsc/Controllers/MusicalTendenciesController.cs @@ -4,7 +4,7 @@ using Microsoft.AspNet.Mvc; namespace Yavsc.Controllers { using Models; - using Models.Booking; + using Models.Musical; public class MusicalTendenciesController : Controller { private ApplicationDbContext _context; diff --git a/Yavsc/Models/ApplicationDbContext.cs b/Yavsc/Models/ApplicationDbContext.cs index 6291fd045..641ed0f82 100644 --- a/Yavsc/Models/ApplicationDbContext.cs +++ b/Yavsc/Models/ApplicationDbContext.cs @@ -17,7 +17,7 @@ namespace Yavsc.Models using YavscLib; using Auth; using Billing; - using Booking; + using Musical; using OAuth; using Workflow; using Identity; @@ -25,7 +25,7 @@ namespace Yavsc.Models using Chat; using Messaging; using Access; - using Booking.Profiles; + using Musical.Profiles; using Workflow.Profiles; using Drawing; public class ApplicationDbContext : IdentityDbContext diff --git a/Yavsc/Models/Booking/Instrument.cs b/Yavsc/Models/Musical/Instrument.cs similarity index 91% rename from Yavsc/Models/Booking/Instrument.cs rename to Yavsc/Models/Musical/Instrument.cs index 694cbde7b..ae93c9c49 100644 --- a/Yavsc/Models/Booking/Instrument.cs +++ b/Yavsc/Models/Musical/Instrument.cs @@ -1,7 +1,7 @@ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; -namespace Yavsc.Models.Booking +namespace Yavsc.Models.Musical { public class Instrument { diff --git a/Yavsc/Models/Booking/InstrumentRating.cs b/Yavsc/Models/Musical/InstrumentRating.cs similarity index 94% rename from Yavsc/Models/Booking/InstrumentRating.cs rename to Yavsc/Models/Musical/InstrumentRating.cs index cd5a6f777..977f5086e 100644 --- a/Yavsc/Models/Booking/InstrumentRating.cs +++ b/Yavsc/Models/Musical/InstrumentRating.cs @@ -2,7 +2,7 @@ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Yavsc.Models.Workflow; -namespace Yavsc.Models.Booking +namespace Yavsc.Models.Musical { public class InstrumentRating { diff --git a/Yavsc/Models/Booking/MusicalPreference.cs b/Yavsc/Models/Musical/MusicalPreference.cs similarity index 89% rename from Yavsc/Models/Booking/MusicalPreference.cs rename to Yavsc/Models/Musical/MusicalPreference.cs index 97e491a6f..4cb3b9244 100644 --- a/Yavsc/Models/Booking/MusicalPreference.cs +++ b/Yavsc/Models/Musical/MusicalPreference.cs @@ -1,7 +1,7 @@ using System.ComponentModel.DataAnnotations; -namespace Yavsc.Models.Booking +namespace Yavsc.Models.Musical { public class MusicalPreference { diff --git a/Yavsc/Models/Booking/MusicalTendency.cs b/Yavsc/Models/Musical/MusicalTendency.cs similarity index 90% rename from Yavsc/Models/Booking/MusicalTendency.cs rename to Yavsc/Models/Musical/MusicalTendency.cs index 3afda65c0..aeb9e06e6 100644 --- a/Yavsc/Models/Booking/MusicalTendency.cs +++ b/Yavsc/Models/Musical/MusicalTendency.cs @@ -3,7 +3,7 @@ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; -namespace Yavsc.Models.Booking { +namespace Yavsc.Models.Musical { diff --git a/Yavsc/Models/Booking/Profiles/DjPerformerProfile.cs b/Yavsc/Models/Musical/Profiles/DjPerformerProfile.cs similarity index 92% rename from Yavsc/Models/Booking/Profiles/DjPerformerProfile.cs rename to Yavsc/Models/Musical/Profiles/DjPerformerProfile.cs index 18613e150..863e82634 100644 --- a/Yavsc/Models/Booking/Profiles/DjPerformerProfile.cs +++ b/Yavsc/Models/Musical/Profiles/DjPerformerProfile.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; using Yavsc.Models.Workflow; -namespace Yavsc.Models.Booking +namespace Yavsc.Models.Musical { public class DjPerformerProfile : SpecializationSettings { diff --git a/Yavsc/Models/Booking/Profiles/DjSettings.cs b/Yavsc/Models/Musical/Profiles/DjSettings.cs similarity index 90% rename from Yavsc/Models/Booking/Profiles/DjSettings.cs rename to Yavsc/Models/Musical/Profiles/DjSettings.cs index 8df23225a..8ca70a7e5 100644 --- a/Yavsc/Models/Booking/Profiles/DjSettings.cs +++ b/Yavsc/Models/Musical/Profiles/DjSettings.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using YavscLib; -namespace Yavsc.Models.Booking.Profiles +namespace Yavsc.Models.Musical.Profiles { public class DjSettings : ISpecializationSettings { diff --git a/Yavsc/Models/Booking/Profiles/FormationPerformerProfile.cs b/Yavsc/Models/Musical/Profiles/FormationPerformerProfile.cs similarity index 87% rename from Yavsc/Models/Booking/Profiles/FormationPerformerProfile.cs rename to Yavsc/Models/Musical/Profiles/FormationPerformerProfile.cs index 66b86c492..b0f9761e5 100644 --- a/Yavsc/Models/Booking/Profiles/FormationPerformerProfile.cs +++ b/Yavsc/Models/Musical/Profiles/FormationPerformerProfile.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; using Yavsc.Models.Workflow; -namespace Yavsc.Models.Booking.Profiles +namespace Yavsc.Models.Musical.Profiles { public class FormationPerformerProfile { diff --git a/Yavsc/Models/Booking/Profiles/GeneralSettings.cs b/Yavsc/Models/Musical/Profiles/GeneralSettings.cs similarity index 89% rename from Yavsc/Models/Booking/Profiles/GeneralSettings.cs rename to Yavsc/Models/Musical/Profiles/GeneralSettings.cs index 860af32fc..11fa903a7 100644 --- a/Yavsc/Models/Booking/Profiles/GeneralSettings.cs +++ b/Yavsc/Models/Musical/Profiles/GeneralSettings.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using YavscLib; -namespace Yavsc.Models.Booking.Profiles +namespace Yavsc.Models.Musical.Profiles { public class GeneralSettings : ISpecializationSettings { diff --git a/Yavsc/Models/Booking/Profiles/Instrumentation.cs b/Yavsc/Models/Musical/Profiles/Instrumentation.cs similarity index 92% rename from Yavsc/Models/Booking/Profiles/Instrumentation.cs rename to Yavsc/Models/Musical/Profiles/Instrumentation.cs index f2f7c0ff4..6ce48bbe4 100644 --- a/Yavsc/Models/Booking/Profiles/Instrumentation.cs +++ b/Yavsc/Models/Musical/Profiles/Instrumentation.cs @@ -2,7 +2,7 @@ using System.ComponentModel.DataAnnotations.Schema; using Yavsc.Models.Workflow; using YavscLib; -namespace Yavsc.Models.Booking.Profiles +namespace Yavsc.Models.Musical.Profiles { public class Instrumentation : ISpecializationSettings { diff --git a/Yavsc/Models/Booking/Profiles/MusicianPerformerProfile.cs b/Yavsc/Models/Musical/Profiles/MusicianPerformerProfile.cs similarity index 91% rename from Yavsc/Models/Booking/Profiles/MusicianPerformerProfile.cs rename to Yavsc/Models/Musical/Profiles/MusicianPerformerProfile.cs index 191344ea6..62719963d 100644 --- a/Yavsc/Models/Booking/Profiles/MusicianPerformerProfile.cs +++ b/Yavsc/Models/Musical/Profiles/MusicianPerformerProfile.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; using Yavsc.Models.Workflow; -namespace Yavsc.Models.Booking +namespace Yavsc.Models.Musical { public class MusicianPerformerProfile : PerformerProfile { diff --git a/Yavsc/Models/Booking/Profiles/StarPerformerProfile.cs b/Yavsc/Models/Musical/Profiles/StarPerformerProfile.cs similarity index 88% rename from Yavsc/Models/Booking/Profiles/StarPerformerProfile.cs rename to Yavsc/Models/Musical/Profiles/StarPerformerProfile.cs index 1dc1a0776..43b976b41 100644 --- a/Yavsc/Models/Booking/Profiles/StarPerformerProfile.cs +++ b/Yavsc/Models/Musical/Profiles/StarPerformerProfile.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; using Yavsc.Models.Workflow; -namespace Yavsc.Models.Booking.Profiles +namespace Yavsc.Models.Musical.Profiles { public class StarPerformerProfile : PerformerProfile { diff --git a/Yavsc/Views/Colors/Create.cshtml b/Yavsc/Views/Colors/Create.cshtml index ecb4a7252..35631493f 100644 --- a/Yavsc/Views/Colors/Create.cshtml +++ b/Yavsc/Views/Colors/Create.cshtml @@ -25,7 +25,6 @@
@await Html.PartialAsync("ColorEditor",Model)
-
diff --git a/Yavsc/Views/Colors/Delete.cshtml b/Yavsc/Views/Colors/Delete.cshtml index 7591855c8..7ff85b755 100644 --- a/Yavsc/Views/Colors/Delete.cshtml +++ b/Yavsc/Views/Colors/Delete.cshtml @@ -15,11 +15,13 @@ @Html.DisplayNameFor(model => model.Name)
+ @Html.DisplayFor(model => model) @Html.DisplayFor(model => model.Name)
+
| Back to List diff --git a/Yavsc/Views/Colors/Details.cshtml b/Yavsc/Views/Colors/Details.cshtml index bb80203d5..c5935b81e 100644 --- a/Yavsc/Views/Colors/Details.cshtml +++ b/Yavsc/Views/Colors/Details.cshtml @@ -14,13 +14,13 @@ @Html.DisplayNameFor(model => model.Name)
- @Html.DisplayFor(model => model.Color) + @Html.DisplayFor(model => model) @Html.DisplayFor(model => model.Name)

- @Html.ActionLink("Edit", "Edit", new { /* id = Model.PrimaryKey */ }) | + @Html.ActionLink("Edit", "Edit", new { id = Model.Id }) | Back to List

diff --git a/Yavsc/Views/Colors/Edit.cshtml b/Yavsc/Views/Colors/Edit.cshtml index 415148f5c..f9173877d 100644 --- a/Yavsc/Views/Colors/Edit.cshtml +++ b/Yavsc/Views/Colors/Edit.cshtml @@ -21,6 +21,15 @@
+
+ +
+ @await Html.PartialAsync("ColorEditor",Model) +
+
+
diff --git a/Yavsc/Views/Colors/Index.cshtml b/Yavsc/Views/Colors/Index.cshtml index 386264930..9d1c9c546 100644 --- a/Yavsc/Views/Colors/Index.cshtml +++ b/Yavsc/Views/Colors/Index.cshtml @@ -24,9 +24,9 @@ @Html.DisplayFor(l => item.Name) - @Html.ActionLink("Edit", "Edit", new { /* id=item.PrimaryKey */ }) | - @Html.ActionLink("Details", "Details", new { /* id=item.PrimaryKey */ }) | - @Html.ActionLink("Delete", "Delete", new { /* id=item.PrimaryKey */ }) + @Html.ActionLink("Edit", "Edit", new { id = item.Id }) | + @Html.ActionLink("Details", "Details", new {id = item.Id }) | + @Html.ActionLink("Delete", "Delete", new { id = item.Id }) } diff --git a/Yavsc/Views/Shared/ColorEditor.cshtml b/Yavsc/Views/Shared/ColorEditor.cshtml index 0bb94d289..354579c7d 100644 --- a/Yavsc/Views/Shared/ColorEditor.cshtml +++ b/Yavsc/Views/Shared/ColorEditor.cshtml @@ -18,8 +18,23 @@ var green = @Model.Green; var blue = @Model.Blue; - $(".slider").slider( + $("#sred").slider( { + value: red, + min: 0, + max: 255, + animate: "fast" + }); + $("#sgreen").slider( + { + value: green, + min: 0, + max: 255, + animate: "fast" + }); + $("#sblue").slider( + { + value: blue, min: 0, max: 255, animate: "fast" @@ -43,6 +58,7 @@ blue=ui.value; updateColor(); }); + updateColor(); }); diff --git a/Yavsc/Views/Shared/_Layout.cshtml b/Yavsc/Views/Shared/_Layout.cshtml index 747dae943..6a43dad5e 100755 --- a/Yavsc/Views/Shared/_Layout.cshtml +++ b/Yavsc/Views/Shared/_Layout.cshtml @@ -18,7 +18,6 @@ - - - + + @RenderSection("header", required: false)