From ba1d064b9924201effc859fb5204bf95e7b55bb8 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Wed, 25 Nov 2015 09:20:55 -0800 Subject: [PATCH] Cleaning up RazorPage --- src/Microsoft.AspNet.Mvc.Razor/RazorPage.cs | 42 ++------------------- 1 file changed, 4 insertions(+), 38 deletions(-) diff --git a/src/Microsoft.AspNet.Mvc.Razor/RazorPage.cs b/src/Microsoft.AspNet.Mvc.Razor/RazorPage.cs index bde2981b27..27b0c8b620 100644 --- a/src/Microsoft.AspNet.Mvc.Razor/RazorPage.cs +++ b/src/Microsoft.AspNet.Mvc.Razor/RazorPage.cs @@ -48,18 +48,7 @@ namespace Microsoft.AspNet.Mvc.Razor /// /// An representing the current request execution. /// - public HttpContext Context - { - get - { - if (ViewContext == null) - { - return null; - } - - return ViewContext.HttpContext; - } - } + public HttpContext Context => ViewContext?.HttpContext; /// public string Path { get; set; } @@ -102,41 +91,18 @@ namespace Microsoft.AspNet.Mvc.Razor /// /// Gets the of the current logged in user. /// - public virtual ClaimsPrincipal User - { - get - { - if (Context == null) - { - return null; - } - - return Context.User; - } - } + public virtual ClaimsPrincipal User => Context?.User; /// /// Gets the dynamic view data dictionary. /// - public dynamic ViewBag - { - get - { - return ViewContext?.ViewBag; - } - } + public dynamic ViewBag => ViewContext?.ViewBag; /// /// Gets the from the . /// /// Returns null if is null. - public ITempDataDictionary TempData - { - get - { - return ViewContext?.TempData; - } - } + public ITempDataDictionary TempData => ViewContext?.TempData; /// public Func RenderBodyDelegateAsync { get; set; }