Skip to content

Commit

Permalink
Fixed bad routes for registration
Browse files Browse the repository at this point in the history
  • Loading branch information
shawnwildermuth committed Jun 3, 2021
1 parent 6ab9611 commit 5547d39
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 27 deletions.
9 changes: 4 additions & 5 deletions src/CoreCodeCamp/Controllers/Web/MonikerControllerBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,8 @@ public MonikerControllerBase(ICodeCampRepository repo, ILogger logger, IMapper m
_mapper = mapper;
}

public async override void OnActionExecuting(ActionExecutingContext context)
public async override Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
{
base.OnActionExecuting(context);

using (var scope = this.HttpContext.RequestServices.CreateScope())
{
var repo = scope.ServiceProvider.GetService<ICodeCampRepository>();
Expand Down Expand Up @@ -62,9 +60,10 @@ public async override void OnActionExecuting(ActionExecutingContext context)
if (_theEvent == null) context.HttpContext.Response.Redirect("/");
else context.HttpContext.Items[Consts.EVENT_INFO_ITEM] = _theEvent;


await base.OnActionExecutionAsync(context, next);

return;
}


}
}
2 changes: 0 additions & 2 deletions src/CoreCodeCamp/Controllers/Web/RootController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,6 @@ public async Task<IActionResult> Schedule(string moniker)
[HttpGet("{moniker}/Register")]
public IActionResult Register(string moniker)
{
if (this._theEvent == null || string.IsNullOrWhiteSpace(this._theEvent.RegistrationLink)) return RedirectToAction("Index");

return View();
}

Expand Down
4 changes: 2 additions & 2 deletions src/CoreCodeCamp/Data/CodeCampRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ public async Task<EventInfo> GetCurrentEventAsync()

public async Task<EventInfo> GetEventInfoAsync(string moniker)
{
var camp = await _ctx.CodeCampEvents
EventInfo camp = await _ctx.CodeCampEvents
.Include(e => e.Location)
.Where(e => e.Moniker == moniker)
.FirstOrDefaultAsync();
.FirstAsync();

if (_config.GetValue<bool>("Data:ShowTestSessionize") == true) {
camp.SessionizeId = "testconf-2020";
Expand Down
13 changes: 2 additions & 11 deletions src/CoreCodeCamp/Extensions/RazorPageExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,9 @@ public static class RazorPageExtensions
{
public static EventInfo GetEventInfo(this RazorPage page)
{
var info = page.Context.Items[Consts.EVENT_INFO_ITEM] as EventInfo;
var item = page.Context.Items[Consts.EVENT_INFO_ITEM];
return item as EventInfo;

// Build a temporary if we can't determine the right event.
if (info == null)
{
info = new EventInfo()
{
Location = new EventLocation(),
Name = "Atlanta Code Camp"
};
}
return info;
}
}
}
1 change: 1 addition & 0 deletions src/CoreCodeCamp/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ public void Configure(IApplicationBuilder app,
});

app.UseExceptionHandler("/Error/Exception");
app.UseHttpsRedirection();

SetupLoggerly(loggerFactory, appLifetime, config);

Expand Down
2 changes: 1 addition & 1 deletion src/CoreCodeCamp/Views/Root/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
}
else
{
<a asp-action="Register" asp-controller="Root" asp-area="" class="btn btn-lg btn-success">Register for @this.GetEventInfo().Name</a>
<a asp-action="Register" asp-controller="Root" asp-area="" asp-route-moniker="@this.GetEventInfo().Moniker" class="btn btn-lg btn-success">Register for @this.GetEventInfo().Name</a>
}
@if (this.GetEventInfo().CallForSpeakersOpened <= DateTime.Today && this.GetEventInfo().CallForSpeakersClosed >= DateTime.Today)
{
Expand Down
23 changes: 17 additions & 6 deletions src/CoreCodeCamp/Views/Root/Register.cshtml
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
<div class="row">
<div class="col-md-8 col-md-offset-2">
<h2>Register for the @this.GetEventInfo().Name</h2>
<p class="text-center">We are using Eventbrite for event registration. Please fill out the following form to register.</p>
<hr/>
<div style="width:100%; text-align:left;">
<iframe src="//eventbrite.com/tickets-external?eid=@(this.GetEventInfo().RegistrationLink)&ref=etckt" frameborder="0" height="300" width="100%" vspace="0" hspace="0" marginheight="5" marginwidth="5" scrolling="auto" allowtransparency="true"></iframe>
</div>
<p class="lead">Alternatively you can register directly on the Eventbrite site at <a href="http://www.eventbrite.com/e/@(this.GetEventInfo().RegistrationLink)?aff=es2">www.eventbrite.com</a></p>
@if (this.GetEventInfo() == null || string.IsNullOrWhiteSpace(this.GetEventInfo().RegistrationLink))
{
<p class="text-center">Registration is not open yet.</p>
<div>@this.GetEventInfo()</div>
<div>@this.GetEventInfo().Name</div>
<div>@this.GetEventInfo().Moniker</div>
<div>@this.GetEventInfo().RegistrationLink</div>
}
else
{
<p class="text-center">We are using Eventbrite for event registration. Please fill out the following form to register.</p>
<hr />
<div style="width:100%; text-align:left;">
<iframe src="//eventbrite.com/tickets-external?eid=@(this.GetEventInfo().RegistrationLink)&ref=etckt" frameborder="0" height="300" width="100%" vspace="0" hspace="0" marginheight="5" marginwidth="5" scrolling="auto" allowtransparency="true"></iframe>
</div>
<p class="lead">Alternatively you can register directly on the Eventbrite site at <a href="http://www.eventbrite.com/e/@(this.GetEventInfo().RegistrationLink)?aff=es2">www.eventbrite.com</a></p>
}
</div>
</div>

0 comments on commit 5547d39

Please sign in to comment.