Cleaning up RazorPage
This commit is contained in:
parent
79d517483b
commit
ba1d064b99
|
|
@ -48,18 +48,7 @@ namespace Microsoft.AspNet.Mvc.Razor
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// An <see cref="HttpContext"/> representing the current request execution.
|
/// An <see cref="HttpContext"/> representing the current request execution.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public HttpContext Context
|
public HttpContext Context => ViewContext?.HttpContext;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (ViewContext == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ViewContext.HttpContext;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public string Path { get; set; }
|
public string Path { get; set; }
|
||||||
|
|
@ -102,41 +91,18 @@ namespace Microsoft.AspNet.Mvc.Razor
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the <see cref="ClaimsPrincipal"/> of the current logged in user.
|
/// Gets the <see cref="ClaimsPrincipal"/> of the current logged in user.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual ClaimsPrincipal User
|
public virtual ClaimsPrincipal User => Context?.User;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (Context == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Context.User;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the dynamic view data dictionary.
|
/// Gets the dynamic view data dictionary.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public dynamic ViewBag
|
public dynamic ViewBag => ViewContext?.ViewBag;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return ViewContext?.ViewBag;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the <see cref="ITempDataDictionary"/> from the <see cref="ViewContext"/>.
|
/// Gets the <see cref="ITempDataDictionary"/> from the <see cref="ViewContext"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>Returns null if <see cref="ViewContext"/> is null.</remarks>
|
/// <remarks>Returns null if <see cref="ViewContext"/> is null.</remarks>
|
||||||
public ITempDataDictionary TempData
|
public ITempDataDictionary TempData => ViewContext?.TempData;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return ViewContext?.TempData;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public Func<TextWriter, Task> RenderBodyDelegateAsync { get; set; }
|
public Func<TextWriter, Task> RenderBodyDelegateAsync { get; set; }
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue