43 lines
925 B
C#
43 lines
925 B
C#
using Microsoft.AspNetCore.Mvc;
|
|
using Library.Models;
|
|
|
|
namespace Library;
|
|
|
|
public class PageController : AbstractController
|
|
{
|
|
protected PageController( ILogger logger , IConfiguration configuration )
|
|
: base( logger , configuration )
|
|
{
|
|
}
|
|
|
|
protected IActionResult View( BasePageModel page_model )
|
|
{
|
|
page_model.UserData = GetUserData( );
|
|
return base.View( page_model );
|
|
}
|
|
|
|
protected IActionResult View( string view_name , BasePageModel page_model)
|
|
{
|
|
page_model.UserData = GetUserData( );
|
|
return base.View( view_name , page_model );
|
|
}
|
|
|
|
protected override void OnInvalidLogin( )
|
|
{
|
|
throw new ErrorException( "Access denied." );
|
|
}
|
|
|
|
protected override void OnInvalidAdminLogin( )
|
|
{
|
|
throw new ErrorException( "Access denied." );
|
|
}
|
|
|
|
protected IActionResult RawText( string text )
|
|
{
|
|
return new ContentResult( )
|
|
{
|
|
ContentType = System.Net.Mime.MediaTypeNames.Text.Plain ,
|
|
Content = text
|
|
};
|
|
}
|
|
} |