Added AdminPages to admin dashboard and navigation + created 2.0 todo list
This commit is contained in:
12
test/FrontendTest/AdminContext.cs
Normal file
12
test/FrontendTest/AdminContext.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using HopFrame.Web.Admin;
|
||||
using HopFrame.Web.Admin.Models;
|
||||
using RestApiTest.Models;
|
||||
|
||||
namespace FrontendTest;
|
||||
|
||||
public class AdminContext : AdminPagesContext {
|
||||
|
||||
public AdminPage<Address> Addresses { get; set; }
|
||||
public AdminPage<Employee> Employees { get; set; }
|
||||
|
||||
}
|
||||
18
test/FrontendTest/Models/Address.cs
Normal file
18
test/FrontendTest/Models/Address.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text.Json.Serialization;
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
||||
|
||||
namespace RestApiTest.Models;
|
||||
|
||||
public class Address {
|
||||
[ForeignKey("Employee")]
|
||||
public int AddressId { get; set; }
|
||||
public string AddressDetails { get; set; }
|
||||
public string City { get; set; }
|
||||
public int ZipCode { get; set; }
|
||||
public string State { get; set; }
|
||||
public string Country { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public virtual Employee Employee { get; set; }
|
||||
}
|
||||
8
test/FrontendTest/Models/Employee.cs
Normal file
8
test/FrontendTest/Models/Employee.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace RestApiTest.Models;
|
||||
|
||||
public class Employee {
|
||||
public int EmployeeId { get; set; }
|
||||
public string Name { get; set; }
|
||||
|
||||
public virtual Address Address { get; set; }
|
||||
}
|
||||
@@ -7,6 +7,7 @@ var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
builder.Services.AddDbContext<DatabaseContext>();
|
||||
builder.Services.AddHopFrame<DatabaseContext>();
|
||||
builder.Services.AddAdminContext<AdminContext>();
|
||||
|
||||
// Add services to the container.
|
||||
builder.Services.AddRazorComponents()
|
||||
|
||||
Reference in New Issue
Block a user