Skip to content

Commit

Permalink
Merge pull request #25 from Kentico/culture-switch-url-fix
Browse files Browse the repository at this point in the history
Fixes an issue where request would fail because of missing route parameters
  • Loading branch information
Enngage authored Feb 27, 2019
2 parents 9cc44ef + 790201d commit 827abeb
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions MedioClinic/Views/Shared/_Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,15 @@
<ul id="langs" class="dropdown-content">
@foreach (var culture in Model.Cultures)
{
var currentRouteValues = new RouteValueDictionary(
Url.RequestContext.RouteData.Values
)
{ ["culture"] = culture.CultureCode };
<li>
<a href="@Url.Action(
ViewContext.RouteData.Values["action"]?.ToString(),
ViewContext.RouteData.Values["controller"]?.ToString(),
new { culture = culture.CultureCode}
)">
currentRouteValues)">
@culture.CultureShortName
</a>
</li>
Expand All @@ -50,7 +53,7 @@
if (ViewContext.RouteData.Values["controller"]?.ToString().Equals(menuItem.Controller, StringComparison.OrdinalIgnoreCase) ?? false)
{
<li class="kn-bold">
<a href="@Url.Action(menuItem.Action, menuItem.Controller)">@menuItem.Caption</a>
<a href="@Url.Action(menuItem.Action, menuItem.Controller)">@menuItem.Caption</a>
</li>
}
else
Expand Down Expand Up @@ -99,7 +102,7 @@
<div class="col l4 s12">
@if (Model.Company != null)
{
<h5 class="white-text">@Html.Localize("Footer.Contact")</h5>
<h5 class="white-text">@Html.Localize("Footer.Contact")</h5>
<div class="grey-text text-lighten-4">
<p class="kn-smaller kn-address">
<address>
Expand Down Expand Up @@ -141,7 +144,7 @@
<div class="row">
<div class="col s12">
<div class="blue-grey-text text-darken-2">
@Html.Raw(Html.Localize("Footer.BuildWithNote")) Kentico, @DateTime.Now.Year.
@Html.Raw(Html.Localize("Footer.BuildWithNote")) Kentico, @DateTime.Now.Year.
</div>
</div>
</div>
Expand Down

0 comments on commit 827abeb

Please sign in to comment.