re-fixes the command creation

A pro now may have specified several activities;
Since, the query creation was broken
This commit is contained in:
2017-01-15 20:49:53 +01:00
parent e84305895e
commit 373d18744f
3 changed files with 8 additions and 3 deletions

View File

@ -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;