From 0acfc2e3b289eb8bc90fe06e47b152fbb8b14443 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 92b95e78..28559844 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 60c3a5b3..35bf5f08 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 701c8490..9dcb81d1 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 f4a0f467..e92d7901 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 c7f2ccd1..e9e7a2c5 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 b63ce9d9..4ad6b778 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 61d7c5e4..df35e49e 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 6291fd04..641ed0f8 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 694cbde7..ae93c9c4 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 cd5a6f77..977f5086 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 97e491a6..4cb3b924 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 3afda65c..aeb9e06e 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 18613e15..863e8263 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 8df23225..8ca70a7e 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 66b86c49..b0f9761e 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 860af32f..11fa903a 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 f2f7c0ff..6ce48bbe 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 191344ea..62719963 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 1dc1a077..43b976b4 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 ecb4a725..35631493 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 7591855c..7ff85b75 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 bb80203d..c5935b81 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 415148f5..f9173877 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 38626493..9d1c9c54 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 0bb94d28..354579c7 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 747dae94..6a43dad5 100755 --- a/Yavsc/Views/Shared/_Layout.cshtml +++ b/Yavsc/Views/Shared/_Layout.cshtml @@ -18,7 +18,6 @@ - - - + + @RenderSection("header", required: false)