re-fixes the command creation
A pro now may have specified several activities; Since, the query creation was broken
This commit is contained in:
@ -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>
|
||||
}
|
||||
|
Reference in New Issue
Block a user