Skip to content

Commit

Permalink
fix exception on getting formatStr, also put that logic in an extensi…
Browse files Browse the repository at this point in the history
…on method to be consistent
  • Loading branch information
adelikat committed Oct 1, 2024
1 parent bb3b872 commit 0355dc3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions TASVideos/Extensions/ViewDataDictionaryExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ public static void SetNavigation(this ViewDataDictionary viewData, int id, strin
viewData["NavigationFmtStr"] = fmtStr;
}

public static string GetNavigationFormatStr(this ViewDataDictionary viewData)
=> viewData["NavigationFmtStr"] as string ?? "";

public static string ActivePageClass(this ViewDataDictionary viewData, string page)
{
var activePage = viewData["ActivePage"] as string;
Expand Down
2 changes: 1 addition & 1 deletion TASVideos/Pages/Shared/_Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
var heading = ViewData.GetHeading();
int? prev = null;
int? next = null;
string? fmtStr = ViewData["NavigationFmtStr"] as string;
string fmtStr = ViewData.GetNavigationFormatStr();
if (User.Has(PermissionTo.CatalogMovies))
{
var id = ViewData.Int("NavigationId");
Expand Down

0 comments on commit 0355dc3

Please sign in to comment.