re-fixes the command creation

A pro now may have specified several activities;
Since, the query creation was broken
vnext
Paul Schneider 8 years ago
parent e84305895e
commit 373d18744f
3 changed files with 8 additions and 3 deletions

@ -91,19 +91,23 @@ namespace Yavsc.Controllers
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
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;

@ -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"); }

@ -10,6 +10,7 @@
await Html.RenderPartialAsync("PerformerProfile", profile) ;
<form action="~/Command/Create" >
<input type="hidden" name="id" value="@profile.PerformerId" />
<input type="hidden" name="activityCode" value="@ViewBag.Activity.Code" />
<input type="submit" value="@SR["Book "+ViewBag.Activity.Code]"/>
</form>
}

Loading…