From a880769679903ef8b3323799f83cc9d1707ed3fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Sat, 14 Sep 2019 11:54:28 +0300 Subject: [PATCH] Aded books page --- ...re.EntityFrameworkCore.DbMigrations.csproj | 2 +- .../BookStoreMigrationsDbContext.cs | 4 +- ...190914071643_Added_Book_Entity.Designer.cs | 1413 +++++++++++++++++ .../20190914071643_Added_Book_Entity.cs | 38 + ...okStoreMigrationsDbContextModelSnapshot.cs | 43 +- .../Acme.BookStore.Web/BookStoreWebModule.cs | 8 +- ...ookManagement.Application.Contracts.csproj | 2 +- .../Books/BookDto.cs | 16 + .../Books/CreateUpdateBookDto.cs | 21 + .../Books/IBookAppService.cs | 17 + .../BookAppService.cs | 20 + ...kManagementApplicationAutoMapperProfile.cs | 8 +- ...kStore.BookManagement.Domain.Shared.csproj | 2 +- .../Books/BookType.cs | 15 + .../Localization/BookManagement/en.json | 3 +- ...cme.BookStore.BookManagement.Domain.csproj | 2 +- .../BookManagementConsts.cs | 2 +- .../Books/Book.cs | 16 + .../BookManagementDataSeedContributor.cs | 47 + .../BookManagementDbContext.cs | 7 +- ...agementDbContextModelCreatingExtensions.cs | 27 +- ...BookManagementEntityFrameworkCoreModule.cs | 1 + .../IBookManagementDbContext.cs | 8 +- .../Acme.BookStore.BookManagement.Web.csproj | 3 +- .../BookManagementMenuContributor.cs | 10 +- .../BookManagement/Books/CreateModal.cshtml | 16 + .../Books/CreateModal.cshtml.cs | 29 + .../Pages/BookManagement/Books/Index.cshtml | 35 + .../BookManagement/Books/Index.cshtml.cs | 16 + .../Pages/BookManagement/Books/index.js | 23 + 30 files changed, 1811 insertions(+), 43 deletions(-) create mode 100644 samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20190914071643_Added_Book_Entity.Designer.cs create mode 100644 samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20190914071643_Added_Book_Entity.cs create mode 100644 samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Application.Contracts/Books/BookDto.cs create mode 100644 samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Application.Contracts/Books/CreateUpdateBookDto.cs create mode 100644 samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Application.Contracts/Books/IBookAppService.cs create mode 100644 samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Application/BookAppService.cs create mode 100644 samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Domain.Shared/Books/BookType.cs create mode 100644 samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Domain/Books/Book.cs create mode 100644 samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Domain/Books/BookManagementDataSeedContributor.cs create mode 100644 samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Web/Pages/BookManagement/Books/CreateModal.cshtml create mode 100644 samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Web/Pages/BookManagement/Books/CreateModal.cshtml.cs create mode 100644 samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Web/Pages/BookManagement/Books/Index.cshtml create mode 100644 samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Web/Pages/BookManagement/Books/Index.cshtml.cs create mode 100644 samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Web/Pages/BookManagement/Books/index.js diff --git a/samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Acme.BookStore.EntityFrameworkCore.DbMigrations.csproj b/samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Acme.BookStore.EntityFrameworkCore.DbMigrations.csproj index 3c9cbca8fc..dde34ac3f7 100644 --- a/samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Acme.BookStore.EntityFrameworkCore.DbMigrations.csproj +++ b/samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Acme.BookStore.EntityFrameworkCore.DbMigrations.csproj @@ -1,4 +1,4 @@ - + diff --git a/samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/EntityFrameworkCore/BookStoreMigrationsDbContext.cs b/samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/EntityFrameworkCore/BookStoreMigrationsDbContext.cs index 541a91a0fd..6a74deef7e 100644 --- a/samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/EntityFrameworkCore/BookStoreMigrationsDbContext.cs +++ b/samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/EntityFrameworkCore/BookStoreMigrationsDbContext.cs @@ -1,4 +1,5 @@ -using Microsoft.EntityFrameworkCore; +using Acme.BookStore.BookManagement.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; using Volo.Abp.AuditLogging.EntityFrameworkCore; using Volo.Abp.BackgroundJobs.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore; @@ -39,6 +40,7 @@ namespace Acme.BookStore.EntityFrameworkCore builder.ConfigureIdentityServer(); builder.ConfigureFeatureManagement(); builder.ConfigureTenantManagement(); + builder.ConfigureBookManagement(); /* Configure customizations for entities from the modules included */ diff --git a/samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20190914071643_Added_Book_Entity.Designer.cs b/samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20190914071643_Added_Book_Entity.Designer.cs new file mode 100644 index 0000000000..a128ddd24f --- /dev/null +++ b/samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20190914071643_Added_Book_Entity.Designer.cs @@ -0,0 +1,1413 @@ +// +using System; +using Acme.BookStore.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace Acme.BookStore.Migrations +{ + [DbContext(typeof(BookStoreMigrationsDbContext))] + [Migration("20190914071643_Added_Book_Entity")] + partial class Added_Book_Entity + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "2.2.6-servicing-10079") + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("Acme.BookStore.BookManagement.Books.Book", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnName("CreatorId"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128); + + b.Property("Price"); + + b.Property("PublishDate"); + + b.Property("Type"); + + b.HasKey("Id"); + + b.ToTable("BmBooks"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ApplicationName") + .HasColumnName("ApplicationName") + .HasMaxLength(96); + + b.Property("BrowserInfo") + .HasColumnName("BrowserInfo") + .HasMaxLength(512); + + b.Property("ClientId") + .HasColumnName("ClientId") + .HasMaxLength(64); + + b.Property("ClientIpAddress") + .HasColumnName("ClientIpAddress") + .HasMaxLength(64); + + b.Property("ClientName") + .HasColumnName("ClientName") + .HasMaxLength(128); + + b.Property("Comments") + .HasColumnName("Comments") + .HasMaxLength(256); + + b.Property("ConcurrencyStamp"); + + b.Property("CorrelationId") + .HasColumnName("CorrelationId") + .HasMaxLength(64); + + b.Property("Exceptions") + .HasColumnName("Exceptions") + .HasMaxLength(4000); + + b.Property("ExecutionDuration") + .HasColumnName("ExecutionDuration"); + + b.Property("ExecutionTime"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties"); + + b.Property("HttpMethod") + .HasColumnName("HttpMethod") + .HasMaxLength(16); + + b.Property("HttpStatusCode") + .HasColumnName("HttpStatusCode"); + + b.Property("ImpersonatorTenantId") + .HasColumnName("ImpersonatorTenantId"); + + b.Property("ImpersonatorUserId") + .HasColumnName("ImpersonatorUserId"); + + b.Property("TenantId") + .HasColumnName("TenantId"); + + b.Property("TenantName"); + + b.Property("Url") + .HasColumnName("Url") + .HasMaxLength(256); + + b.Property("UserId") + .HasColumnName("UserId"); + + b.Property("UserName") + .HasColumnName("UserName") + .HasMaxLength(256); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "ExecutionTime"); + + b.HasIndex("TenantId", "UserId", "ExecutionTime"); + + b.ToTable("AbpAuditLogs"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("AuditLogId") + .HasColumnName("AuditLogId"); + + b.Property("ExecutionDuration") + .HasColumnName("ExecutionDuration"); + + b.Property("ExecutionTime") + .HasColumnName("ExecutionTime"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties"); + + b.Property("MethodName") + .HasColumnName("MethodName") + .HasMaxLength(128); + + b.Property("Parameters") + .HasColumnName("Parameters") + .HasMaxLength(2000); + + b.Property("ServiceName") + .HasColumnName("ServiceName") + .HasMaxLength(256); + + b.Property("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("AuditLogId"); + + b.HasIndex("TenantId", "ServiceName", "MethodName", "ExecutionTime"); + + b.ToTable("AbpAuditLogActions"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("AuditLogId") + .HasColumnName("AuditLogId"); + + b.Property("ChangeTime") + .HasColumnName("ChangeTime"); + + b.Property("ChangeType") + .HasColumnName("ChangeType"); + + b.Property("EntityId") + .IsRequired() + .HasColumnName("EntityId") + .HasMaxLength(128); + + b.Property("EntityTenantId"); + + b.Property("EntityTypeFullName") + .IsRequired() + .HasColumnName("EntityTypeFullName") + .HasMaxLength(128); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties"); + + b.Property("TenantId") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("AuditLogId"); + + b.HasIndex("TenantId", "EntityTypeFullName", "EntityId"); + + b.ToTable("AbpEntityChanges"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("EntityChangeId"); + + b.Property("NewValue") + .HasColumnName("NewValue") + .HasMaxLength(512); + + b.Property("OriginalValue") + .HasColumnName("OriginalValue") + .HasMaxLength(512); + + b.Property("PropertyName") + .IsRequired() + .HasColumnName("PropertyName") + .HasMaxLength(128); + + b.Property("PropertyTypeFullName") + .IsRequired() + .HasColumnName("PropertyTypeFullName") + .HasMaxLength(64); + + b.Property("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("EntityChangeId"); + + b.ToTable("AbpEntityPropertyChanges"); + }); + + modelBuilder.Entity("Volo.Abp.BackgroundJobs.BackgroundJobRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnName("CreationTime"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties"); + + b.Property("IsAbandoned") + .ValueGeneratedOnAdd() + .HasDefaultValue(false); + + b.Property("JobArgs") + .IsRequired() + .HasMaxLength(1048576); + + b.Property("JobName") + .IsRequired() + .HasMaxLength(128); + + b.Property("LastTryTime"); + + b.Property("NextTryTime"); + + b.Property("Priority") + .ValueGeneratedOnAdd() + .HasDefaultValue((byte)15); + + b.Property("TryCount") + .ValueGeneratedOnAdd() + .HasDefaultValue((short)0); + + b.HasKey("Id"); + + b.HasIndex("IsAbandoned", "NextTryTime"); + + b.ToTable("AbpBackgroundJobs"); + }); + + modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureValue", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128); + + b.Property("ProviderKey") + .HasMaxLength(64); + + b.Property("ProviderName") + .HasMaxLength(64); + + b.Property("Value") + .IsRequired() + .HasMaxLength(128); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpFeatureValues"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasColumnName("ConcurrencyStamp") + .HasMaxLength(256); + + b.Property("Description") + .HasMaxLength(256); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties"); + + b.Property("IsStatic"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256); + + b.Property("Regex") + .HasMaxLength(512); + + b.Property("RegexDescription") + .HasMaxLength(128); + + b.Property("Required"); + + b.Property("ValueType"); + + b.HasKey("Id"); + + b.ToTable("AbpClaimTypes"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasColumnName("ConcurrencyStamp") + .HasMaxLength(256); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties"); + + b.Property("IsDefault") + .HasColumnName("IsDefault"); + + b.Property("IsPublic") + .HasColumnName("IsPublic"); + + b.Property("IsStatic") + .HasColumnName("IsStatic"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256); + + b.Property("NormalizedName") + .IsRequired() + .HasMaxLength(256); + + b.Property("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName"); + + b.ToTable("AbpRoles"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ClaimType") + .IsRequired() + .HasMaxLength(256); + + b.Property("ClaimValue") + .HasMaxLength(1024); + + b.Property("RoleId"); + + b.Property("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AbpRoleClaims"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("AccessFailedCount") + .ValueGeneratedOnAdd() + .HasColumnName("AccessFailedCount") + .HasDefaultValue(0); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime"); + + b.Property("Email") + .HasColumnName("Email") + .HasMaxLength(256); + + b.Property("EmailConfirmed") + .ValueGeneratedOnAdd() + .HasColumnName("EmailConfirmed") + .HasDefaultValue(false); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId"); + + b.Property("LockoutEnabled") + .ValueGeneratedOnAdd() + .HasColumnName("LockoutEnabled") + .HasDefaultValue(false); + + b.Property("LockoutEnd"); + + b.Property("Name") + .HasColumnName("Name") + .HasMaxLength(64); + + b.Property("NormalizedEmail") + .HasColumnName("NormalizedEmail") + .HasMaxLength(256); + + b.Property("NormalizedUserName") + .IsRequired() + .HasColumnName("NormalizedUserName") + .HasMaxLength(256); + + b.Property("PasswordHash") + .HasColumnName("PasswordHash") + .HasMaxLength(256); + + b.Property("PhoneNumber") + .HasColumnName("PhoneNumber") + .HasMaxLength(16); + + b.Property("PhoneNumberConfirmed") + .ValueGeneratedOnAdd() + .HasColumnName("PhoneNumberConfirmed") + .HasDefaultValue(false); + + b.Property("SecurityStamp") + .IsRequired() + .HasColumnName("SecurityStamp") + .HasMaxLength(256); + + b.Property("Surname") + .HasColumnName("Surname") + .HasMaxLength(64); + + b.Property("TenantId") + .HasColumnName("TenantId"); + + b.Property("TwoFactorEnabled") + .ValueGeneratedOnAdd() + .HasColumnName("TwoFactorEnabled") + .HasDefaultValue(false); + + b.Property("UserName") + .IsRequired() + .HasColumnName("UserName") + .HasMaxLength(256); + + b.HasKey("Id"); + + b.HasIndex("Email"); + + b.HasIndex("NormalizedEmail"); + + b.HasIndex("NormalizedUserName"); + + b.HasIndex("UserName"); + + b.ToTable("AbpUsers"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ClaimType") + .IsRequired() + .HasMaxLength(256); + + b.Property("ClaimValue") + .HasMaxLength(1024); + + b.Property("TenantId"); + + b.Property("UserId"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AbpUserClaims"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => + { + b.Property("UserId"); + + b.Property("LoginProvider") + .HasMaxLength(64); + + b.Property("ProviderDisplayName") + .HasMaxLength(128); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(196); + + b.Property("TenantId"); + + b.HasKey("UserId", "LoginProvider"); + + b.HasIndex("LoginProvider", "ProviderKey"); + + b.ToTable("AbpUserLogins"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => + { + b.Property("UserId"); + + b.Property("RoleId"); + + b.Property("TenantId"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId", "UserId"); + + b.ToTable("AbpUserRoles"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => + { + b.Property("UserId"); + + b.Property("LoginProvider") + .HasMaxLength(64); + + b.Property("Name") + .HasMaxLength(128); + + b.Property("TenantId"); + + b.Property("Value"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AbpUserTokens"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResource", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(1000); + + b.Property("DisplayName") + .HasMaxLength(200); + + b.Property("Enabled"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200); + + b.HasKey("Id"); + + b.ToTable("IdentityServerApiResources"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => + { + b.Property("ApiResourceId"); + + b.Property("Type") + .HasMaxLength(196); + + b.HasKey("ApiResourceId", "Type"); + + b.ToTable("IdentityServerApiClaims"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScope", b => + { + b.Property("ApiResourceId"); + + b.Property("Name") + .HasMaxLength(196); + + b.Property("Description") + .HasMaxLength(256); + + b.Property("DisplayName") + .HasMaxLength(128); + + b.Property("Emphasize"); + + b.Property("Required"); + + b.Property("ShowInDiscoveryDocument"); + + b.HasKey("ApiResourceId", "Name"); + + b.ToTable("IdentityServerApiScopes"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScopeClaim", b => + { + b.Property("ApiResourceId"); + + b.Property("Name") + .HasMaxLength(196); + + b.Property("Type") + .HasMaxLength(196); + + b.HasKey("ApiResourceId", "Name", "Type"); + + b.ToTable("IdentityServerApiScopeClaims"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiSecret", b => + { + b.Property("ApiResourceId"); + + b.Property("Type") + .HasMaxLength(32); + + b.Property("Value") + .HasMaxLength(196); + + b.Property("Description") + .HasMaxLength(256); + + b.Property("Expiration"); + + b.HasKey("ApiResourceId", "Type", "Value"); + + b.ToTable("IdentityServerApiSecrets"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.Client", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("AbsoluteRefreshTokenLifetime"); + + b.Property("AccessTokenLifetime"); + + b.Property("AccessTokenType"); + + b.Property("AllowAccessTokensViaBrowser"); + + b.Property("AllowOfflineAccess"); + + b.Property("AllowPlainTextPkce"); + + b.Property("AllowRememberConsent"); + + b.Property("AlwaysIncludeUserClaimsInIdToken"); + + b.Property("AlwaysSendClientClaims"); + + b.Property("AuthorizationCodeLifetime"); + + b.Property("BackChannelLogoutSessionRequired"); + + b.Property("BackChannelLogoutUri") + .HasMaxLength(300); + + b.Property("ClientClaimsPrefix") + .HasMaxLength(200); + + b.Property("ClientId") + .IsRequired() + .HasMaxLength(200); + + b.Property("ClientName") + .HasMaxLength(200); + + b.Property("ClientUri") + .HasMaxLength(300); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp"); + + b.Property("ConsentLifetime"); + + b.Property("CreationTime") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(1000); + + b.Property("EnableLocalLogin"); + + b.Property("Enabled"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties"); + + b.Property("FrontChannelLogoutSessionRequired"); + + b.Property("FrontChannelLogoutUri") + .HasMaxLength(300); + + b.Property("IdentityTokenLifetime"); + + b.Property("IncludeJwtId"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId"); + + b.Property("LogoUri") + .HasMaxLength(300); + + b.Property("PairWiseSubjectSalt") + .HasMaxLength(200); + + b.Property("ProtocolType") + .IsRequired() + .HasMaxLength(200); + + b.Property("RefreshTokenExpiration"); + + b.Property("RefreshTokenUsage"); + + b.Property("RequireClientSecret"); + + b.Property("RequireConsent"); + + b.Property("RequirePkce"); + + b.Property("SlidingRefreshTokenLifetime"); + + b.Property("UpdateAccessTokenClaimsOnRefresh"); + + b.HasKey("Id"); + + b.HasIndex("ClientId") + .IsUnique(); + + b.ToTable("IdentityServerClients"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b => + { + b.Property("ClientId"); + + b.Property("Type") + .HasMaxLength(250); + + b.Property("Value") + .HasMaxLength(250); + + b.HasKey("ClientId", "Type", "Value"); + + b.ToTable("IdentityServerClientClaims"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b => + { + b.Property("ClientId"); + + b.Property("Origin") + .HasMaxLength(150); + + b.HasKey("ClientId", "Origin"); + + b.ToTable("IdentityServerClientCorsOrigins"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b => + { + b.Property("ClientId"); + + b.Property("GrantType") + .HasMaxLength(196); + + b.HasKey("ClientId", "GrantType"); + + b.ToTable("IdentityServerClientGrantTypes"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b => + { + b.Property("ClientId"); + + b.Property("Provider") + .HasMaxLength(64); + + b.HasKey("ClientId", "Provider"); + + b.ToTable("IdentityServerClientIdPRestrictions"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b => + { + b.Property("ClientId"); + + b.Property("PostLogoutRedirectUri") + .HasMaxLength(200); + + b.HasKey("ClientId", "PostLogoutRedirectUri"); + + b.ToTable("IdentityServerClientPostLogoutRedirectUris"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b => + { + b.Property("ClientId"); + + b.Property("Key") + .HasMaxLength(64); + + b.Property("Value") + .IsRequired() + .HasMaxLength(128); + + b.HasKey("ClientId", "Key"); + + b.ToTable("IdentityServerClientProperties"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b => + { + b.Property("ClientId"); + + b.Property("RedirectUri") + .HasMaxLength(200); + + b.HasKey("ClientId", "RedirectUri"); + + b.ToTable("IdentityServerClientRedirectUris"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b => + { + b.Property("ClientId"); + + b.Property("Scope") + .HasMaxLength(196); + + b.HasKey("ClientId", "Scope"); + + b.ToTable("IdentityServerClientScopes"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b => + { + b.Property("ClientId"); + + b.Property("Type") + .HasMaxLength(32); + + b.Property("Value") + .HasMaxLength(196); + + b.Property("Description") + .HasMaxLength(256); + + b.Property("Expiration"); + + b.HasKey("ClientId", "Type", "Value"); + + b.ToTable("IdentityServerClientSecrets"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Grants.PersistedGrant", b => + { + b.Property("Key") + .HasMaxLength(200); + + b.Property("ClientId") + .IsRequired() + .HasMaxLength(200); + + b.Property("ConcurrencyStamp"); + + b.Property("CreationTime"); + + b.Property("Data") + .IsRequired(); + + b.Property("Expiration"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties"); + + b.Property("Id"); + + b.Property("SubjectId") + .HasMaxLength(200); + + b.Property("Type") + .IsRequired() + .HasMaxLength(50); + + b.HasKey("Key"); + + b.HasIndex("SubjectId", "ClientId", "Type"); + + b.ToTable("IdentityServerPersistedGrants"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityClaim", b => + { + b.Property("IdentityResourceId"); + + b.Property("Type") + .HasMaxLength(196); + + b.HasKey("IdentityResourceId", "Type"); + + b.ToTable("IdentityServerIdentityClaims"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasMaxLength(1000); + + b.Property("DisplayName") + .HasMaxLength(200); + + b.Property("Emphasize"); + + b.Property("Enabled"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200); + + b.Property("Required"); + + b.Property("ShowInDiscoveryDocument"); + + b.HasKey("Id"); + + b.ToTable("IdentityServerIdentityResources"); + }); + + modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(64); + + b.Property("ProviderName") + .IsRequired() + .HasMaxLength(64); + + b.Property("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpPermissionGrants"); + }); + + modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128); + + b.Property("ProviderKey") + .HasMaxLength(64); + + b.Property("ProviderName") + .HasMaxLength(64); + + b.Property("Value") + .IsRequired() + .HasMaxLength(2048); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpSettings"); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("AbpTenants"); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => + { + b.Property("TenantId"); + + b.Property("Name") + .HasMaxLength(64); + + b.Property("Value") + .IsRequired() + .HasMaxLength(1024); + + b.HasKey("TenantId", "Name"); + + b.ToTable("AbpTenantConnectionStrings"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => + { + b.HasOne("Volo.Abp.AuditLogging.AuditLog") + .WithMany("Actions") + .HasForeignKey("AuditLogId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.HasOne("Volo.Abp.AuditLogging.AuditLog") + .WithMany("EntityChanges") + .HasForeignKey("AuditLogId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => + { + b.HasOne("Volo.Abp.AuditLogging.EntityChange") + .WithMany("PropertyChanges") + .HasForeignKey("EntityChangeId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => + { + b.HasOne("Volo.Abp.Identity.IdentityRole") + .WithMany("Claims") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser") + .WithMany("Claims") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser") + .WithMany("Logins") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => + { + b.HasOne("Volo.Abp.Identity.IdentityRole") + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("Volo.Abp.Identity.IdentityUser") + .WithMany("Roles") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser") + .WithMany("Tokens") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => + { + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource") + .WithMany("UserClaims") + .HasForeignKey("ApiResourceId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScope", b => + { + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource") + .WithMany("Scopes") + .HasForeignKey("ApiResourceId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScopeClaim", b => + { + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiScope") + .WithMany("UserClaims") + .HasForeignKey("ApiResourceId", "Name") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiSecret", b => + { + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource") + .WithMany("Secrets") + .HasForeignKey("ApiResourceId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + .WithMany("Claims") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + .WithMany("AllowedCorsOrigins") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + .WithMany("AllowedGrantTypes") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + .WithMany("IdentityProviderRestrictions") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + .WithMany("PostLogoutRedirectUris") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + .WithMany("Properties") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + .WithMany("RedirectUris") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + .WithMany("AllowedScopes") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + .WithMany("ClientSecrets") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityClaim", b => + { + b.HasOne("Volo.Abp.IdentityServer.IdentityResources.IdentityResource") + .WithMany("UserClaims") + .HasForeignKey("IdentityResourceId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => + { + b.HasOne("Volo.Abp.TenantManagement.Tenant") + .WithMany("ConnectionStrings") + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20190914071643_Added_Book_Entity.cs b/samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20190914071643_Added_Book_Entity.cs new file mode 100644 index 0000000000..c36a18416a --- /dev/null +++ b/samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20190914071643_Added_Book_Entity.cs @@ -0,0 +1,38 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Acme.BookStore.Migrations +{ + public partial class Added_Book_Entity : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "BmBooks", + columns: table => new + { + Id = table.Column(nullable: false), + ExtraProperties = table.Column(nullable: true), + ConcurrencyStamp = table.Column(nullable: true), + CreationTime = table.Column(nullable: false), + CreatorId = table.Column(nullable: true), + LastModificationTime = table.Column(nullable: true), + LastModifierId = table.Column(nullable: true), + Name = table.Column(maxLength: 128, nullable: false), + Type = table.Column(nullable: false), + PublishDate = table.Column(nullable: false), + Price = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_BmBooks", x => x.Id); + }); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "BmBooks"); + } + } +} diff --git a/samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/BookStoreMigrationsDbContextModelSnapshot.cs b/samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/BookStoreMigrationsDbContextModelSnapshot.cs index ef6ab488e5..dc4ed9bd93 100644 --- a/samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/BookStoreMigrationsDbContextModelSnapshot.cs +++ b/samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/BookStoreMigrationsDbContextModelSnapshot.cs @@ -1,10 +1,10 @@ // using System; +using Acme.BookStore.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Acme.BookStore.EntityFrameworkCore; namespace Acme.BookStore.Migrations { @@ -15,10 +15,49 @@ namespace Acme.BookStore.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "2.2.4-servicing-10062") + .HasAnnotation("ProductVersion", "2.2.6-servicing-10079") .HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + modelBuilder.Entity("Acme.BookStore.BookManagement.Books.Book", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnName("CreatorId"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128); + + b.Property("Price"); + + b.Property("PublishDate"); + + b.Property("Type"); + + b.HasKey("Id"); + + b.ToTable("BmBooks"); + }); + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => { b.Property("Id") diff --git a/samples/BookStore-Modular/application/src/Acme.BookStore.Web/BookStoreWebModule.cs b/samples/BookStore-Modular/application/src/Acme.BookStore.Web/BookStoreWebModule.cs index af4647440a..50b375d9f3 100644 --- a/samples/BookStore-Modular/application/src/Acme.BookStore.Web/BookStoreWebModule.cs +++ b/samples/BookStore-Modular/application/src/Acme.BookStore.Web/BookStoreWebModule.cs @@ -1,4 +1,5 @@ using System.IO; +using Acme.BookStore.BookManagement; using Acme.BookStore.BookManagement.Web; using Localization.Resources.AbpUi; using Microsoft.AspNetCore.Builder; @@ -115,6 +116,7 @@ namespace Acme.BookStore.Web { Configure(options => { + options.FileSets.ReplaceEmbeddedByPhysical(Path.Combine(hostingEnvironment.ContentRootPath, $"..{Path.DirectorySeparatorChar}..{Path.DirectorySeparatorChar}..{Path.DirectorySeparatorChar}modules{Path.DirectorySeparatorChar}book-management{Path.DirectorySeparatorChar}src{Path.DirectorySeparatorChar}Acme.BookStore.BookManagement.Web")); options.FileSets.ReplaceEmbeddedByPhysical(Path.Combine(hostingEnvironment.ContentRootPath, $"..{Path.DirectorySeparatorChar}Acme.BookStore.Domain.Shared")); options.FileSets.ReplaceEmbeddedByPhysical(Path.Combine(hostingEnvironment.ContentRootPath, $"..{Path.DirectorySeparatorChar}Acme.BookStore.Domain")); options.FileSets.ReplaceEmbeddedByPhysical(Path.Combine(hostingEnvironment.ContentRootPath, $"..{Path.DirectorySeparatorChar}Acme.BookStore.Application.Contracts")); @@ -154,7 +156,11 @@ namespace Acme.BookStore.Web { Configure(options => { - options.ConventionalControllers.Create(typeof(BookStoreApplicationModule).Assembly); + options.ConventionalControllers + .Create(typeof(BookManagementApplicationModule).Assembly); + + options.ConventionalControllers + .Create(typeof(BookStoreApplicationModule).Assembly); }); } diff --git a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Application.Contracts/Acme.BookStore.BookManagement.Application.Contracts.csproj b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Application.Contracts/Acme.BookStore.BookManagement.Application.Contracts.csproj index 391180c11b..3e0bb6fd5d 100644 --- a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Application.Contracts/Acme.BookStore.BookManagement.Application.Contracts.csproj +++ b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Application.Contracts/Acme.BookStore.BookManagement.Application.Contracts.csproj @@ -1,4 +1,4 @@ - + diff --git a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Application.Contracts/Books/BookDto.cs b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Application.Contracts/Books/BookDto.cs new file mode 100644 index 0000000000..a1ff4cd44a --- /dev/null +++ b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Application.Contracts/Books/BookDto.cs @@ -0,0 +1,16 @@ +using System; +using Volo.Abp.Application.Dtos; + +namespace Acme.BookStore.BookManagement.Books +{ + public class BookDto : AuditedEntityDto + { + public string Name { get; set; } + + public BookType Type { get; set; } + + public DateTime PublishDate { get; set; } + + public float Price { get; set; } + } +} diff --git a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Application.Contracts/Books/CreateUpdateBookDto.cs b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Application.Contracts/Books/CreateUpdateBookDto.cs new file mode 100644 index 0000000000..d9aec3e7dd --- /dev/null +++ b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Application.Contracts/Books/CreateUpdateBookDto.cs @@ -0,0 +1,21 @@ +using System; +using System.ComponentModel.DataAnnotations; + +namespace Acme.BookStore.BookManagement.Books +{ + public class CreateUpdateBookDto + { + [Required] + [StringLength(128)] + public string Name { get; set; } + + [Required] + public BookType Type { get; set; } = BookType.Undefined; + + [Required] + public DateTime PublishDate { get; set; } + + [Required] + public float Price { get; set; } + } +} \ No newline at end of file diff --git a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Application.Contracts/Books/IBookAppService.cs b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Application.Contracts/Books/IBookAppService.cs new file mode 100644 index 0000000000..48054520ac --- /dev/null +++ b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Application.Contracts/Books/IBookAppService.cs @@ -0,0 +1,17 @@ +using System; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Application.Services; + +namespace Acme.BookStore.BookManagement.Books +{ + public interface IBookAppService : + ICrudAppService< //Defines CRUD methods + BookDto, //Used to show books + Guid, //Primary key of the book entity + PagedAndSortedResultRequestDto, //Used for paging/sorting on getting a list of books + CreateUpdateBookDto, //Used to create a new book + CreateUpdateBookDto> //Used to update a book + { + + } +} \ No newline at end of file diff --git a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Application/BookAppService.cs b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Application/BookAppService.cs new file mode 100644 index 0000000000..09a5c6cab2 --- /dev/null +++ b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Application/BookAppService.cs @@ -0,0 +1,20 @@ +using System; +using Acme.BookStore.BookManagement.Books; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Application.Services; +using Volo.Abp.Domain.Repositories; + +namespace Acme.BookStore.BookManagement +{ + public class BookAppService : + CrudAppService, + IBookAppService + { + public BookAppService(IRepository repository) + : base(repository) + { + + } + } +} \ No newline at end of file diff --git a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Application/BookManagementApplicationAutoMapperProfile.cs b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Application/BookManagementApplicationAutoMapperProfile.cs index 47c478b517..60002ad174 100644 --- a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Application/BookManagementApplicationAutoMapperProfile.cs +++ b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Application/BookManagementApplicationAutoMapperProfile.cs @@ -1,4 +1,5 @@ -using AutoMapper; +using Acme.BookStore.BookManagement.Books; +using AutoMapper; namespace Acme.BookStore.BookManagement { @@ -6,9 +7,8 @@ namespace Acme.BookStore.BookManagement { public BookManagementApplicationAutoMapperProfile() { - /* You can configure your AutoMapper mapping configuration here. - * Alternatively, you can split your mapping configurations - * into multiple profile classes for a better organization. */ + CreateMap(); + CreateMap(MemberList.Source); } } } \ No newline at end of file diff --git a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Domain.Shared/Acme.BookStore.BookManagement.Domain.Shared.csproj b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Domain.Shared/Acme.BookStore.BookManagement.Domain.Shared.csproj index 49062c275c..590835bef5 100644 --- a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Domain.Shared/Acme.BookStore.BookManagement.Domain.Shared.csproj +++ b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Domain.Shared/Acme.BookStore.BookManagement.Domain.Shared.csproj @@ -1,4 +1,4 @@ - + diff --git a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Domain.Shared/Books/BookType.cs b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Domain.Shared/Books/BookType.cs new file mode 100644 index 0000000000..14fdc7e609 --- /dev/null +++ b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Domain.Shared/Books/BookType.cs @@ -0,0 +1,15 @@ +namespace Acme.BookStore.BookManagement.Books +{ + public enum BookType + { + Undefined, + Adventure, + Biography, + Dystopia, + Fantastic, + Horror, + Science, + ScienceFiction, + Poetry + } +} \ No newline at end of file diff --git a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Domain.Shared/Localization/BookManagement/en.json b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Domain.Shared/Localization/BookManagement/en.json index 92e4e9582b..f0d43c4d82 100644 --- a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Domain.Shared/Localization/BookManagement/en.json +++ b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Domain.Shared/Localization/BookManagement/en.json @@ -1,6 +1,7 @@ { "culture": "en", "texts": { - + "Menu:BookManagement": "Book Management", + "Menu:Books": "Books" } } \ No newline at end of file diff --git a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Domain/Acme.BookStore.BookManagement.Domain.csproj b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Domain/Acme.BookStore.BookManagement.Domain.csproj index 5db82a8a93..cdf079622b 100644 --- a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Domain/Acme.BookStore.BookManagement.Domain.csproj +++ b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Domain/Acme.BookStore.BookManagement.Domain.csproj @@ -1,4 +1,4 @@ - + diff --git a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Domain/BookManagementConsts.cs b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Domain/BookManagementConsts.cs index 135639a7bd..ce4731503d 100644 --- a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Domain/BookManagementConsts.cs +++ b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Domain/BookManagementConsts.cs @@ -2,7 +2,7 @@ { public static class BookManagementConsts { - public const string DefaultDbTablePrefix = "BookManagement"; + public const string DefaultDbTablePrefix = "Bm"; public const string DefaultDbSchema = null; } diff --git a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Domain/Books/Book.cs b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Domain/Books/Book.cs new file mode 100644 index 0000000000..66ce4e8e61 --- /dev/null +++ b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Domain/Books/Book.cs @@ -0,0 +1,16 @@ +using System; +using Volo.Abp.Domain.Entities.Auditing; + +namespace Acme.BookStore.BookManagement.Books +{ + public class Book : AuditedAggregateRoot + { + public string Name { get; set; } + + public BookType Type { get; set; } + + public DateTime PublishDate { get; set; } + + public float Price { get; set; } + } +} diff --git a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Domain/Books/BookManagementDataSeedContributor.cs b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Domain/Books/BookManagementDataSeedContributor.cs new file mode 100644 index 0000000000..d5cf2b8325 --- /dev/null +++ b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Domain/Books/BookManagementDataSeedContributor.cs @@ -0,0 +1,47 @@ +using System; +using System.Linq; +using System.Threading.Tasks; +using Volo.Abp.Data; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Domain.Repositories; +using Volo.Abp.Guids; +using Volo.Abp.Linq; + +namespace Acme.BookStore.BookManagement.Books +{ + public class BookManagementDataSeedContributor : IDataSeedContributor, ITransientDependency + { + private readonly IRepository _bookRepository; + private readonly IAsyncQueryableExecuter _queryableExecuter; + private readonly IGuidGenerator _guidGenerator; + + public BookManagementDataSeedContributor( + IRepository bookRepository, + IAsyncQueryableExecuter queryableExecuter, + IGuidGenerator guidGenerator) + { + _bookRepository = bookRepository; + _queryableExecuter = queryableExecuter; + _guidGenerator = guidGenerator; + } + + public async Task SeedAsync(DataSeedContext context) + { + if (await _queryableExecuter.CountAsync(_bookRepository) > 0) + { + return; + } + + await _bookRepository.InsertAsync( + new Book + { + Id = _guidGenerator.Create(), + Name = "Pet Sematary", + Price = 42, + PublishDate = new DateTime(1995,11,15), + Type = BookType.Horror + } + ); + } + } +} diff --git a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.EntityFrameworkCore/EntityFrameworkCore/BookManagementDbContext.cs b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.EntityFrameworkCore/EntityFrameworkCore/BookManagementDbContext.cs index f2fddde976..4fb37e86f4 100644 --- a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.EntityFrameworkCore/EntityFrameworkCore/BookManagementDbContext.cs +++ b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.EntityFrameworkCore/EntityFrameworkCore/BookManagementDbContext.cs @@ -1,4 +1,5 @@ -using Microsoft.EntityFrameworkCore; +using Acme.BookStore.BookManagement.Books; +using Microsoft.EntityFrameworkCore; using Volo.Abp.Data; using Volo.Abp.EntityFrameworkCore; @@ -11,9 +12,7 @@ namespace Acme.BookStore.BookManagement.EntityFrameworkCore public static string Schema { get; set; } = BookManagementConsts.DefaultDbSchema; - /* Add DbSet for each Aggregate Root here. Example: - * public DbSet Questions { get; set; } - */ + public DbSet Books { get; set; } public BookManagementDbContext(DbContextOptions options) : base(options) diff --git a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.EntityFrameworkCore/EntityFrameworkCore/BookManagementDbContextModelCreatingExtensions.cs b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.EntityFrameworkCore/EntityFrameworkCore/BookManagementDbContextModelCreatingExtensions.cs index 9087d591dd..ab8d497e0d 100644 --- a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.EntityFrameworkCore/EntityFrameworkCore/BookManagementDbContextModelCreatingExtensions.cs +++ b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.EntityFrameworkCore/EntityFrameworkCore/BookManagementDbContextModelCreatingExtensions.cs @@ -1,6 +1,8 @@ using System; +using Acme.BookStore.BookManagement.Books; using Microsoft.EntityFrameworkCore; using Volo.Abp; +using Volo.Abp.EntityFrameworkCore.Modeling; namespace Acme.BookStore.BookManagement.EntityFrameworkCore { @@ -16,25 +18,12 @@ namespace Acme.BookStore.BookManagement.EntityFrameworkCore optionsAction?.Invoke(options); - /* Configure all entities here. Example: - - builder.Entity(b => - { - //Configure table & schema name - b.ToTable(options.TablePrefix + "Questions", options.Schema); - - b.ConfigureFullAuditedAggregateRoot(); - - //Properties - b.Property(q => q.Title).IsRequired().HasMaxLength(QuestionConsts.MaxTitleLength); - - //Relations - b.HasMany(question => question.Tags).WithOne().HasForeignKey(qt => qt.QuestionId); - - //Indexes - b.HasIndex(q => q.CreationTime); - }); - */ + builder.Entity(b => + { + b.ToTable(BookManagementConsts.DefaultDbTablePrefix + "Books", BookManagementConsts.DefaultDbSchema); + b.ConfigureByConvention(); //auto configure for the base class props + b.Property(x => x.Name).IsRequired().HasMaxLength(128); + }); } } } \ No newline at end of file diff --git a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.EntityFrameworkCore/EntityFrameworkCore/BookManagementEntityFrameworkCoreModule.cs b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.EntityFrameworkCore/EntityFrameworkCore/BookManagementEntityFrameworkCoreModule.cs index 7265ae32af..c2b2867938 100644 --- a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.EntityFrameworkCore/EntityFrameworkCore/BookManagementEntityFrameworkCoreModule.cs +++ b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.EntityFrameworkCore/EntityFrameworkCore/BookManagementEntityFrameworkCoreModule.cs @@ -14,6 +14,7 @@ namespace Acme.BookStore.BookManagement.EntityFrameworkCore { context.Services.AddAbpDbContext(options => { + options.AddDefaultRepositories(); /* Add custom repositories here. Example: * options.AddRepository(); */ diff --git a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.EntityFrameworkCore/EntityFrameworkCore/IBookManagementDbContext.cs b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.EntityFrameworkCore/EntityFrameworkCore/IBookManagementDbContext.cs index ba7ff9c571..baaed8357f 100644 --- a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.EntityFrameworkCore/EntityFrameworkCore/IBookManagementDbContext.cs +++ b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.EntityFrameworkCore/EntityFrameworkCore/IBookManagementDbContext.cs @@ -1,4 +1,6 @@ -using Volo.Abp.Data; +using Acme.BookStore.BookManagement.Books; +using Microsoft.EntityFrameworkCore; +using Volo.Abp.Data; using Volo.Abp.EntityFrameworkCore; namespace Acme.BookStore.BookManagement.EntityFrameworkCore @@ -6,8 +8,6 @@ namespace Acme.BookStore.BookManagement.EntityFrameworkCore [ConnectionStringName("BookManagement")] public interface IBookManagementDbContext : IEfCoreDbContext { - /* Add DbSet for each Aggregate Root here. Example: - * DbSet Questions { get; } - */ + DbSet Books { get; } } } \ No newline at end of file diff --git a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Web/Acme.BookStore.BookManagement.Web.csproj b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Web/Acme.BookStore.BookManagement.Web.csproj index f7d2869e5e..b5eff21126 100644 --- a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Web/Acme.BookStore.BookManagement.Web.csproj +++ b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Web/Acme.BookStore.BookManagement.Web.csproj @@ -1,4 +1,4 @@ - + @@ -30,6 +30,7 @@ + diff --git a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Web/BookManagementMenuContributor.cs b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Web/BookManagementMenuContributor.cs index 57291d38ba..6b85aec3e0 100644 --- a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Web/BookManagementMenuContributor.cs +++ b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Web/BookManagementMenuContributor.cs @@ -1,4 +1,7 @@ using System.Threading.Tasks; +using Acme.BookStore.BookManagement.Localization; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Localization; using Volo.Abp.UI.Navigation; namespace Acme.BookStore.BookManagement.Web @@ -15,7 +18,12 @@ namespace Acme.BookStore.BookManagement.Web private Task ConfigureMainMenu(MenuConfigurationContext context) { - //Add main menu items. + var stringLocalizer = context.ServiceProvider.GetRequiredService>(); + + context.Menu.AddItem( + new ApplicationMenuItem("BookManagement", stringLocalizer["Menu:BookManagement"]) + .AddItem(new ApplicationMenuItem("BookManagement.Books", stringLocalizer["Menu:Books"], url: "/BookManagement/Books")) + ); return Task.CompletedTask; } diff --git a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Web/Pages/BookManagement/Books/CreateModal.cshtml b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Web/Pages/BookManagement/Books/CreateModal.cshtml new file mode 100644 index 0000000000..1e7ff558f2 --- /dev/null +++ b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Web/Pages/BookManagement/Books/CreateModal.cshtml @@ -0,0 +1,16 @@ +@page +@model Acme.BookStore.BookManagement.Web.Pages.BookManagement.Books.CreateModalModel +@inherits Acme.BookStore.BookManagement.Web.Pages.BookManagementPage +@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal +@{ + Layout = null; +} + + + + + + + + + \ No newline at end of file diff --git a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Web/Pages/BookManagement/Books/CreateModal.cshtml.cs b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Web/Pages/BookManagement/Books/CreateModal.cshtml.cs new file mode 100644 index 0000000000..522c7cdc21 --- /dev/null +++ b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Web/Pages/BookManagement/Books/CreateModal.cshtml.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Acme.BookStore.BookManagement.Books; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace Acme.BookStore.BookManagement.Web.Pages.BookManagement.Books +{ + public class CreateModalModel : BookManagementPageModel + { + [BindProperty] + public CreateUpdateBookDto Book { get; set; } + + private readonly IBookAppService _bookAppService; + + public CreateModalModel(IBookAppService bookAppService) + { + _bookAppService = bookAppService; + } + + public async Task OnPostAsync() + { + await _bookAppService.CreateAsync(Book); + return NoContent(); + } + } +} \ No newline at end of file diff --git a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Web/Pages/BookManagement/Books/Index.cshtml b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Web/Pages/BookManagement/Books/Index.cshtml new file mode 100644 index 0000000000..8a7ba8ba77 --- /dev/null +++ b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Web/Pages/BookManagement/Books/Index.cshtml @@ -0,0 +1,35 @@ +@page +@model Acme.BookStore.BookManagement.Web.Pages.BookManagement.Books.IndexModel +@inherits Acme.BookStore.BookManagement.Web.Pages.BookManagementPage +@section scripts +{ + +} + + + + +

@L["Books"]

+
+ + + +
+
+ + + + + @L["Name"] + @L["Type"] + @L["PublishDate"] + @L["Price"] + @L["CreationTime"] + + + + +
\ No newline at end of file diff --git a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Web/Pages/BookManagement/Books/Index.cshtml.cs b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Web/Pages/BookManagement/Books/Index.cshtml.cs new file mode 100644 index 0000000000..3b7fbcce46 --- /dev/null +++ b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Web/Pages/BookManagement/Books/Index.cshtml.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace Acme.BookStore.BookManagement.Web.Pages.BookManagement.Books +{ + public class IndexModel : PageModel + { + public void OnGet() + { + } + } +} \ No newline at end of file diff --git a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Web/Pages/BookManagement/Books/index.js b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Web/Pages/BookManagement/Books/index.js new file mode 100644 index 0000000000..1d528ee368 --- /dev/null +++ b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Web/Pages/BookManagement/Books/index.js @@ -0,0 +1,23 @@ +$(function () { + var dataTable = $('#BooksTable').DataTable(abp.libs.datatables.normalizeConfiguration({ + ajax: abp.libs.datatables.createAjax(acme.bookStore.bookManagement.book.getList), + columnDefs: [ + { data: "name" }, + { data: "type" }, + { data: "publishDate" }, + { data: "price" }, + { data: "creationTime" } + ] + })); + + var createModal = new abp.ModalManager(abp.appPath + 'BookManagement/Books/CreateModal'); + + createModal.onResult(function () { + dataTable.ajax.reload(); + }); + + $('#NewBookButton').click(function (e) { + e.preventDefault(); + createModal.open(); + }); +}); \ No newline at end of file