Skip to content

anupvarghese/Ilaro.Admin

 
 

Repository files navigation

Ilaro.Admin

Ilaro.Admin creates for you admin panel using only POCO classes.

Demo - using Northwind DB (with small modifications, removed multiple primary keys)

Project was inspired by Django admin site.

Please keep in mind this is still a alpha version.

Get it from nuget:

If you are using Unity install:

Install-Package Ilaro.Admin.Unity

Or if you using Ninject install:

Install-Package Ilaro.Admin.Ninject

Or you can just install:

Install-Package Ilaro.Admin

And register by yourself all needed stuff.

##TODO I don't plan milestones, so I will do things in random order. Maybe some of them I skip, and I probably I will back to them after release v1.

I moved TODO to wiki pages, because here, it did a mess in commits, and I rather would simple list than a issues pages.

##Requirements:

  • POCO classes (or pseudo POCO)
  • ASP MVC 4

##Initialisation:

In global.asax you must do three things:

  1. Register routes

    // prefix is optional, by default = IlaroAdmin
    AdminInitialise.RegisterRoutes(RouteTable.Routes, prefix: "Admin");
    AdminInitialise.RegisterResourceRoutes(RouteTable.Routes);

    It should be before register default routes because you lose a friendly urls

  2. Add entities

    AdminInitialise.AddEntity<Customer>();
    AdminInitialise.AddEntity<Product>();

    AddEntity method create a EntityViewModel object with all info from attributes. In future I want add here a fluent configuration of entity so, there is no need to configure entity with attributes.

  3. Specify access to Ilaro.Admin

    AdminInitialise.Authorize = new System.Web.Mvc.AuthorizeAttribute { Roles = "Admin" };

    If you don't do that everyone with proper link have access to Ilaro.Admin.

  4. Initialise Ilaro.Admin

    AdminInitialise.Initialise("NorthwindEntities");

    This line initialise UnityContainer, and bind foreign entity and try set primary key for each entity who has not defeined it. If you have only one ConnectionString there is no need to specify it.

  5. Go to wiki pages for more info. Entity configuration Property configuration

And after that when you go to ~/IlaroAdmin url (if you don't define a other prefix) and you should view something like that: ####Dashboard Ilaro.Admin dashboard ####Records list Ilaro.Admin records list ####Create new record Ilaro.Admin create new record

##What I use Here I will try write all libraries, and part of code I use in project.

##Knowing issue

  • Validation - for validate entity I using data annotations attributes (it probably works with custom ValidationAttribute), and client side validation look nice, but problem starts with server side validation.

[Required] [StringLength(20)] [Compare("Other property")] public string ProductName { get; set; }

In this example Required and StringLength works well but there is problem with Compare (in client side works well).

About

Generic admin panel for ASP.NET MVC.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 97.7%
  • CSS 1.2%
  • JavaScript 1.1%