From 26b056c324341e65a8fc1c95e6de06542afe8878 Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Wed, 22 Apr 2020 11:16:50 +0800 Subject: [PATCH] Improve code --- .../Pages/Documents/Project/Index.cshtml | 51 ++++++++++--------- .../Pages/Documents/Project/Index.cshtml.cs | 6 +-- 2 files changed, 29 insertions(+), 28 deletions(-) diff --git a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml index f347ec2227..74f7c21464 100644 --- a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml +++ b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml @@ -153,11 +153,11 @@ - @@ -172,11 +172,11 @@ - @@ -226,8 +226,8 @@ @if (!string.IsNullOrEmpty(Model.Document.EditLink)) { - - @(L["Edit"]) + + @(L["Edit"]) (@L["LastEditTime"]: @Model.Document.LastUpdatedTime.ToShortDateString()) } @@ -349,6 +349,19 @@ } else { + if (!Model.ProjectFound) + { + @(await Component.InvokeAsync(new + { + model = new ErrorPageModel + { + RedirectUrl = Model.DocumentsUrlPrefix, + ErrorCode = "404", + ErrorMessage = L.GetString("ProjectNotFound") + } + })) + } + if (!Model.DocumentFound) { @(await Component.InvokeAsync(new @@ -362,16 +375,4 @@ else } })) } - if (!Model.EntityFound) - { - @(await Component.InvokeAsync(new - { - model = new ErrorPageModel - { - RedirectUrl = Model.DocumentsUrlPrefix, - ErrorCode = "404", - ErrorMessage = L.GetString("ProjectNotFound") - } - })) - } -} \ No newline at end of file +} diff --git a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml.cs b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml.cs index c57ee28fd3..f5758447e4 100644 --- a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml.cs +++ b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml.cs @@ -35,9 +35,9 @@ namespace Volo.Docs.Pages.Documents.Project public bool DocumentFound { get; set; } = true; - public bool EntityFound { get; set; } = true; + public bool ProjectFound { get; set; } = true; - public bool LoadSuccess => DocumentFound && EntityFound; + public bool LoadSuccess => DocumentFound && ProjectFound; public string DefaultLanguageCode { get; set; } @@ -122,7 +122,7 @@ namespace Volo.Docs.Pages.Documents.Project catch (EntityNotFoundException e) { Logger.LogWarning(e.Message); - EntityFound = false; + ProjectFound = false; return Page(); }