From e1e4112e4f0746b86d044bf12c04dbe0d1ecf312 Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Mon, 25 Jun 2018 09:08:00 +0300 Subject: [PATCH] added redirect if there is only one blog --- .../src/Volo.Blogging.Web/Pages/Blog/Index.cshtml.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Index.cshtml.cs b/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Index.cshtml.cs index 7874b5352b..39291cb5a2 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Index.cshtml.cs +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Index.cshtml.cs @@ -22,6 +22,12 @@ namespace Volo.Blogging.Pages.Blog { var result = await _blogAppService.GetListAsync(); + if (result.Items.Count == 1) + { + var blog = result.Items[0]; + return RedirectToPage("./Posts/Index", new { blogShortName = blog.ShortName}); + } + Blogs = result.Items; return Page(); }