Skip to content

madeyoga/MyAdmin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Admin

Automatic admin interface for aspnetcore. It reads metadata from entity type registered in options and DbContext.

using MyAdmin.Admin;

public class DummyModel
{
    [Key]
    public int Id { get; set; }

    [DataType(DataType.EmailAddress)]
    public string Email { get; set; } = "test@gmail.com";

    [DataType(DataType.Password)]
    public string? Password { get; set; }

    [DataType(DataType.MultilineText)]
    public string? Note { get; set; } = "Test";

    [Required]
    [DataType(DataType.Date)]
    public DateTime? CreatedDate { get; set; } = DateTime.Now;

    [DataType(DataType.DateTime)]
    public DateTime? CreatedDateTime { get; set; }

    [ForeignKey("ContentTypeId")]
    public ContentType? ContentType { get; set; }
}

public class MyDbContext : DbContext
{
    public DbSet<ContentType> ContentTypes { get; set; }
    public DbSet<DummyModel> DummyModels { get; set; }
}
// Program.cs

builder.Services.AddAdmin<MyDbContext>(options =>
{
    options.Register<ContentType>();
    options.Register<DummyModel>();
    options.SiteName = "aspnetcore";
});

...

app.MapGroup("/admin/")
   .MapAdminEndpoints<MyDbContext>();

About

Automatic admin interface for aspnetcore.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages