66 lines
1.6 KiB
C#
66 lines
1.6 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
|
using System.Diagnostics;
|
|
using Library.Models;
|
|
|
|
namespace Library.Controllers;
|
|
|
|
public class HomeController : PageController
|
|
{
|
|
public HomeController( ILogger<HomeController> logger , IConfiguration configuration )
|
|
: base( logger , configuration )
|
|
{
|
|
}
|
|
|
|
[Route( "" )]
|
|
[Route( "Home/Index" )]
|
|
public IActionResult Index( )
|
|
{
|
|
Trace( "/Home/Index" );
|
|
return View( new BasePageModel( GetDBConnection( ) ) );
|
|
}
|
|
|
|
[Route( "Login" )]
|
|
public IActionResult Login( )
|
|
{
|
|
Trace( "/Home/Login" );
|
|
return View( new BasePageModel( GetDBConnection( ) ) );
|
|
}
|
|
|
|
[Route( "Sitemap" )]
|
|
public IActionResult Sitemap( )
|
|
{
|
|
Trace( "/Home/Sitemap" );
|
|
return View( new BasePageModel( GetDBConnection( ) ) );
|
|
}
|
|
|
|
[Route( "Search" )]
|
|
public IActionResult Search( string q , int page )
|
|
{
|
|
Trace( "/Home/Search" );
|
|
return View( new SearchPageModel( GetDBConnection( ) , q , page ) );
|
|
}
|
|
|
|
[Route( "Repository" )]
|
|
[Route( "Repository/{id?}" )]
|
|
public IActionResult Repository( int id , int page )
|
|
{
|
|
Trace( "/Home/Repository" );
|
|
return View( new RepositoryPageModel( GetDBConnection( ) , id , page ) );
|
|
}
|
|
|
|
[Route( "Repository/Details" )]
|
|
[Route( "Repository/Details/{id?}" )]
|
|
public IActionResult RepositoryDetails( int id )
|
|
{
|
|
Trace( "/Home/RepositoryDetails" );
|
|
return View( new RepositoryDetailsPageModel( GetDBConnection( ) , id ) );
|
|
}
|
|
|
|
[ResponseCache( Duration = 0 , Location = ResponseCacheLocation.None , NoStore = true )]
|
|
public IActionResult Error( )
|
|
{
|
|
Trace( "/Home/Error" );
|
|
return View( new ErrorPageModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier } );
|
|
}
|
|
}
|