Browse Source

Aded books page

pull/1810/head
Halil İbrahim Kalkan 7 years ago
parent
commit
a880769679
  1. 2
      samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Acme.BookStore.EntityFrameworkCore.DbMigrations.csproj
  2. 4
      samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/EntityFrameworkCore/BookStoreMigrationsDbContext.cs
  3. 1413
      samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20190914071643_Added_Book_Entity.Designer.cs
  4. 38
      samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20190914071643_Added_Book_Entity.cs
  5. 43
      samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/BookStoreMigrationsDbContextModelSnapshot.cs
  6. 8
      samples/BookStore-Modular/application/src/Acme.BookStore.Web/BookStoreWebModule.cs
  7. 2
      samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Application.Contracts/Acme.BookStore.BookManagement.Application.Contracts.csproj
  8. 16
      samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Application.Contracts/Books/BookDto.cs
  9. 21
      samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Application.Contracts/Books/CreateUpdateBookDto.cs
  10. 17
      samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Application.Contracts/Books/IBookAppService.cs
  11. 20
      samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Application/BookAppService.cs
  12. 8
      samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Application/BookManagementApplicationAutoMapperProfile.cs
  13. 2
      samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Domain.Shared/Acme.BookStore.BookManagement.Domain.Shared.csproj
  14. 15
      samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Domain.Shared/Books/BookType.cs
  15. 3
      samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Domain.Shared/Localization/BookManagement/en.json
  16. 2
      samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Domain/Acme.BookStore.BookManagement.Domain.csproj
  17. 2
      samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Domain/BookManagementConsts.cs
  18. 16
      samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Domain/Books/Book.cs
  19. 47
      samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Domain/Books/BookManagementDataSeedContributor.cs
  20. 7
      samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.EntityFrameworkCore/EntityFrameworkCore/BookManagementDbContext.cs
  21. 27
      samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.EntityFrameworkCore/EntityFrameworkCore/BookManagementDbContextModelCreatingExtensions.cs
  22. 1
      samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.EntityFrameworkCore/EntityFrameworkCore/BookManagementEntityFrameworkCoreModule.cs
  23. 8
      samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.EntityFrameworkCore/EntityFrameworkCore/IBookManagementDbContext.cs
  24. 3
      samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Web/Acme.BookStore.BookManagement.Web.csproj
  25. 10
      samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Web/BookManagementMenuContributor.cs
  26. 16
      samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Web/Pages/BookManagement/Books/CreateModal.cshtml
  27. 29
      samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Web/Pages/BookManagement/Books/CreateModal.cshtml.cs
  28. 35
      samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Web/Pages/BookManagement/Books/Index.cshtml
  29. 16
      samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Web/Pages/BookManagement/Books/Index.cshtml.cs
  30. 23
      samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Web/Pages/BookManagement/Books/index.js

2
samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Acme.BookStore.EntityFrameworkCore.DbMigrations.csproj

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\common.props" />

4
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 */

1413
samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20190914071643_Added_Book_Entity.Designer.cs

File diff suppressed because it is too large

38
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<Guid>(nullable: false),
ExtraProperties = table.Column<string>(nullable: true),
ConcurrencyStamp = table.Column<string>(nullable: true),
CreationTime = table.Column<DateTime>(nullable: false),
CreatorId = table.Column<Guid>(nullable: true),
LastModificationTime = table.Column<DateTime>(nullable: true),
LastModifierId = table.Column<Guid>(nullable: true),
Name = table.Column<string>(maxLength: 128, nullable: false),
Type = table.Column<int>(nullable: false),
PublishDate = table.Column<DateTime>(nullable: false),
Price = table.Column<float>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_BmBooks", x => x.Id);
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "BmBooks");
}
}
}

43
samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/BookStoreMigrationsDbContextModelSnapshot.cs

@ -1,10 +1,10 @@
// <auto-generated />
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<Guid>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId");
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties");
b.Property<DateTime?>("LastModificationTime")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnName("LastModifierId");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128);
b.Property<float>("Price");
b.Property<DateTime>("PublishDate");
b.Property<int>("Type");
b.HasKey("Id");
b.ToTable("BmBooks");
});
modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b =>
{
b.Property<Guid>("Id")

8
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<VirtualFileSystemOptions>(options =>
{
options.FileSets.ReplaceEmbeddedByPhysical<BookManagementWebModule>(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<BookStoreDomainSharedModule>(Path.Combine(hostingEnvironment.ContentRootPath, $"..{Path.DirectorySeparatorChar}Acme.BookStore.Domain.Shared"));
options.FileSets.ReplaceEmbeddedByPhysical<BookStoreDomainModule>(Path.Combine(hostingEnvironment.ContentRootPath, $"..{Path.DirectorySeparatorChar}Acme.BookStore.Domain"));
options.FileSets.ReplaceEmbeddedByPhysical<BookStoreApplicationContractsModule>(Path.Combine(hostingEnvironment.ContentRootPath, $"..{Path.DirectorySeparatorChar}Acme.BookStore.Application.Contracts"));
@ -154,7 +156,11 @@ namespace Acme.BookStore.Web
{
Configure<AbpAspNetCoreMvcOptions>(options =>
{
options.ConventionalControllers.Create(typeof(BookStoreApplicationModule).Assembly);
options.ConventionalControllers
.Create(typeof(BookManagementApplicationModule).Assembly);
options.ConventionalControllers
.Create(typeof(BookStoreApplicationModule).Assembly);
});
}

2
samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Application.Contracts/Acme.BookStore.BookManagement.Application.Contracts.csproj

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\common.props" />

16
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<Guid>
{
public string Name { get; set; }
public BookType Type { get; set; }
public DateTime PublishDate { get; set; }
public float Price { get; set; }
}
}

21
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; }
}
}

17
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
{
}
}

20
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<Book, BookDto, Guid, PagedAndSortedResultRequestDto,
CreateUpdateBookDto, CreateUpdateBookDto>,
IBookAppService
{
public BookAppService(IRepository<Book, Guid> repository)
: base(repository)
{
}
}
}

8
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<Book, BookDto>();
CreateMap<CreateUpdateBookDto, Book>(MemberList.Source);
}
}
}

2
samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Domain.Shared/Acme.BookStore.BookManagement.Domain.Shared.csproj

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\common.props" />

15
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
}
}

3
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"
}
}

2
samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Domain/Acme.BookStore.BookManagement.Domain.csproj

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\common.props" />

2
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;
}

16
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<Guid>
{
public string Name { get; set; }
public BookType Type { get; set; }
public DateTime PublishDate { get; set; }
public float Price { get; set; }
}
}

47
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<Book, Guid> _bookRepository;
private readonly IAsyncQueryableExecuter _queryableExecuter;
private readonly IGuidGenerator _guidGenerator;
public BookManagementDataSeedContributor(
IRepository<Book, Guid> 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
}
);
}
}
}

7
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<Question> Questions { get; set; }
*/
public DbSet<Book> Books { get; set; }
public BookManagementDbContext(DbContextOptions<BookManagementDbContext> options)
: base(options)

27
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<Question>(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<Book>(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);
});
}
}
}

1
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<BookManagementDbContext>(options =>
{
options.AddDefaultRepositories<IBookManagementDbContext>();
/* Add custom repositories here. Example:
* options.AddRepository<Question, EfCoreQuestionRepository>();
*/

8
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<Question> Questions { get; }
*/
DbSet<Book> Books { get; }
}
}

3
samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Web/Acme.BookStore.BookManagement.Web.csproj

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
<Import Project="..\..\common.props" />
@ -30,6 +30,7 @@
<ItemGroup>
<Content Remove="Properties\launchSettings.json" />
<None Remove="Pages\BookManagement\Books\index.js" />
<None Include="Properties\launchSettings.json" />
</ItemGroup>

10
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<IStringLocalizer<BookManagementResource>>();
context.Menu.AddItem(
new ApplicationMenuItem("BookManagement", stringLocalizer["Menu:BookManagement"])
.AddItem(new ApplicationMenuItem("BookManagement.Books", stringLocalizer["Menu:Books"], url: "/BookManagement/Books"))
);
return Task.CompletedTask;
}

16
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;
}
<abp-dynamic-form abp-model="Book" data-ajaxForm="true" asp-page="/BookManagement/Books/CreateModal">
<abp-modal>
<abp-modal-header title="@L["NewBook"].Value"></abp-modal-header>
<abp-modal-body>
<abp-form-content />
</abp-modal-body>
<abp-modal-footer buttons="@(AbpModalButtons.Cancel|AbpModalButtons.Save)"></abp-modal-footer>
</abp-modal>
</abp-dynamic-form>

29
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<IActionResult> OnPostAsync()
{
await _bookAppService.CreateAsync(Book);
return NoContent();
}
}
}

35
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
{
<abp-script src="/Pages/BookManagement/Books/index.js" />
}
<abp-card>
<abp-card-header>
<abp-row>
<abp-column size-md="_6">
<h2>@L["Books"]</h2>
</abp-column>
<abp-column size-md="_6" class="text-right">
<abp-button id="NewBookButton"
text="@L["NewBook"].Value"
icon="plus"
button-type="Primary" />
</abp-column>
</abp-row>
</abp-card-header>
<abp-card-body>
<abp-table striped-rows="true" id="BooksTable">
<thead>
<tr>
<th>@L["Name"]</th>
<th>@L["Type"]</th>
<th>@L["PublishDate"]</th>
<th>@L["Price"]</th>
<th>@L["CreationTime"]</th>
</tr>
</thead>
</abp-table>
</abp-card-body>
</abp-card>

16
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()
{
}
}
}

23
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();
});
});
Loading…
Cancel
Save