Ram.AdminFramework
1.0.0
Verwaltungsrahmen für ASP.NET MVC
Die Grundidee dieser Bibliothek ist das Dashboard des Kraatsadministration ohne Bereich, der wie ## admin bezeichnet wird
Beispiel 1: Basic Homecontroller in der Gegend zu Hause
public class HomeController : Controller {
public ActionResult Index ( ) {
return Content ( "this is home page... " ) ;
}
public ActionResult About ( ) {
return Content ( "this is about page... " ) ;
}
public ActionResult Contacts ( ) {
return Content ( "this is contacts page... " ) ;
}
}Und Arearegistration Class
public class HomeAreaRegistration : AreaRegistration {
public override void RegisterArea ( AreaRegistrationContext context ) {
context . Routes . MapRoute ( "index" , "" , new {
controller = "Home" ,
action = "index"
} ) ;
context . Routes . MapRoute ( "about" , "about" , new {
controller = "Home" ,
action = "about"
} ) ;
context . Routes . MapRoute ( "contacts" , "contacts" , new {
controller = "Home" ,
action = "contacts"
} ) ;
}
public override string AreaName { get ; } = "Home" ;
}Jetzt können Sie dies einfach ohne ArearegistrationContext -Klasse tun
RouteManager . GetProvider ( )
. WithArea ( "Home" )
. WithController ( "Home" )
. withAction ( "" , "index" , "index" )
. withAction ( "about" , "about" )
. withAction ( "contacts" , "contacts" ) ;Oder wenn Sie Routen mit demselben Namen wie Controller -Aktionen verwenden möchten, die Sie verwenden können:
RouteManager . GetProvider ( )
. WithArea ( "Home" )
. WithController ( "Home" )
. withActions ( "index" , "about" , "contacts" ) ;Es wird /index, /um /kontaktiert zugeordnet