From 373d18744fcbdea6042c66d6786d36ed6a0cd7ab Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Sun, 15 Jan 2017 20:49:53 +0100 Subject: [PATCH] re-fixes the command creation A pro now may have specified several activities; Since, the query creation was broken --- Yavsc/Controllers/CommandController.cs | 8 ++++++-- Yavsc/Views/Command/Create.cshtml | 2 +- Yavsc/Views/FrontOffice/Book.cshtml | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Yavsc/Controllers/CommandController.cs b/Yavsc/Controllers/CommandController.cs index 4b2a2d62..90c7d682 100644 --- a/Yavsc/Controllers/CommandController.cs +++ b/Yavsc/Controllers/CommandController.cs @@ -91,19 +91,23 @@ namespace Yavsc.Controllers /// /// /// - public IActionResult Create(string id) + public IActionResult Create(string id, string activityCode) { if (string.IsNullOrWhiteSpace(id)) throw new InvalidOperationException( "This method needs a performer id" ); + if (string.IsNullOrWhiteSpace(activityCode)) + throw new InvalidOperationException( + "This method needs an activity code" + ); var pro = _context.Performers.Include( x => x.Performer).FirstOrDefault( x => x.PerformerId == id ); if (pro == null) return HttpNotFound(); - + ViewBag.Activity = _context.Activities.FirstOrDefault(a=>a.Code == activityCode); ViewBag.GoogleSettings = _googleSettings; var userid = User.GetUserId(); var user = _userManager.FindByIdAsync(userid).Result; diff --git a/Yavsc/Views/Command/Create.cshtml b/Yavsc/Views/Command/Create.cshtml index 33c1a6ed..0ebb5b3d 100644 --- a/Yavsc/Views/Command/Create.cshtml +++ b/Yavsc/Views/Command/Create.cshtml @@ -1,6 +1,6 @@ @model BookQuery @{ - ViewData["Title"] = SR["Book "+Model.PerformerProfile.ActivityCode]; + ViewData["Title"] = SR["Book "+ViewBag.Activity.Code]; } @section header{ @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); } diff --git a/Yavsc/Views/FrontOffice/Book.cshtml b/Yavsc/Views/FrontOffice/Book.cshtml index 6f77f910..9acda2a1 100644 --- a/Yavsc/Views/FrontOffice/Book.cshtml +++ b/Yavsc/Views/FrontOffice/Book.cshtml @@ -10,6 +10,7 @@ await Html.RenderPartialAsync("PerformerProfile", profile) ;
+
}