Browse Source

Upgraded bookstore sample.

pull/341/head
Halil ibrahim Kalkan 8 years ago
parent
commit
4877a38e5b
  1. 2
      samples/BookStore/src/Acme.BookStore.Application/Acme.BookStore.Application.csproj
  2. 2
      samples/BookStore/src/Acme.BookStore.Application/BookStoreApplicationAutoMapperProfile.cs
  3. 4
      samples/BookStore/src/Acme.BookStore.Application/IBookAppService.cs
  4. 2
      samples/BookStore/src/Acme.BookStore.Domain/Acme.BookStore.Domain.csproj
  5. 2
      samples/BookStore/src/Acme.BookStore.Domain/Book.cs
  6. 2
      samples/BookStore/src/Acme.BookStore.Domain/BookStoreDomainModule.cs
  7. 4
      samples/BookStore/src/Acme.BookStore.Domain/Localization/BookStore/en.json
  8. 4
      samples/BookStore/src/Acme.BookStore.Domain/Localization/BookStore/tr.json
  9. 8
      samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Acme.BookStore.EntityFrameworkCore.csproj
  10. 9
      samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Migrations/20180528221424_Initial.Designer.cs
  11. 1
      samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Migrations/20180528221424_Initial.cs
  12. 2
      samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Migrations/20180703184727_Created_Book_Entity.Designer.cs
  13. 0
      samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Migrations/20180703184727_Created_Book_Entity.cs
  14. 10
      samples/BookStore/src/Acme.BookStore.Web/Acme.BookStore.Web.csproj
  15. 2
      samples/BookStore/src/Acme.BookStore.Web/BookStoreWebAutoMapperProfile.cs
  16. 37
      samples/BookStore/src/Acme.BookStore.Web/BookStoreWebModule.cs
  17. 2
      samples/BookStore/src/Acme.BookStore.Web/Pages/Books/EditModal.cshtml
  18. 2
      samples/BookStore/src/Acme.BookStore.Web/Pages/Books/EditModal.cshtml.cs
  19. 16
      samples/BookStore/src/Acme.BookStore.Web/Pages/Books/Index.cshtml
  20. 6
      samples/BookStore/src/Acme.BookStore.Web/Pages/Books/Index.cshtml.cs
  21. 4
      samples/BookStore/src/Acme.BookStore.Web/Properties/launchSettings.json
  22. 79
      samples/BookStore/src/Acme.BookStore.Web/wwwroot/pages/books/index.js
  23. 8
      samples/BookStore/test/Acme.BookStore.Application.Tests/Acme.BookStore.Application.Tests.csproj
  24. 6
      samples/BookStore/test/Acme.BookStore.Application.Tests/BookAppService_Tests.cs
  25. 4
      samples/BookStore/test/Acme.BookStore.Web.Tests/Acme.BookStore.Web.Tests.csproj

2
samples/BookStore/src/Acme.BookStore.Application/Acme.BookStore.Application.csproj

@ -7,7 +7,7 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Acme.BookStore.Domain\Acme.BookStore.Domain.csproj" /> <ProjectReference Include="..\Acme.BookStore.Domain\Acme.BookStore.Domain.csproj" />
<PackageReference Include="Volo.Abp.Identity.Application" Version="0.3.4" /> <PackageReference Include="Volo.Abp.Identity.Application" Version="0.3.5" />
</ItemGroup> </ItemGroup>
</Project> </Project>

2
samples/BookStore/src/Acme.BookStore.Application/BookStoreApplicationAutoMapperProfile.cs

@ -6,7 +6,7 @@ namespace Acme.BookStore
{ {
public BookStoreApplicationAutoMapperProfile() public BookStoreApplicationAutoMapperProfile()
{ {
//add your custom AutoMapper configuration //Configure your AutoMapper mapping configuration here...
} }
} }
} }

4
samples/BookStore/src/Acme.BookStore.Application/IBookAppService.cs

@ -4,7 +4,7 @@ using Volo.Abp.Application.Services;
namespace Acme.BookStore namespace Acme.BookStore
{ {
public interface IBookAppService : public interface IBookAppService :
IAsyncCrudAppService< //Defines CRUD methods IAsyncCrudAppService< //Defines CRUD methods
BookDto, //Used to show books BookDto, //Used to show books
Guid, //Primary key of the book entity Guid, //Primary key of the book entity
@ -14,4 +14,4 @@ namespace Acme.BookStore
{ {
} }
} }

2
samples/BookStore/src/Acme.BookStore.Domain/Acme.BookStore.Domain.csproj

@ -6,7 +6,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Volo.Abp.Identity.Domain" Version="0.3.4" /> <PackageReference Include="Volo.Abp.Identity.Domain" Version="0.3.5" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.DataAnnotations" Version="2.1.1" /> <PackageReference Include="Microsoft.AspNetCore.Mvc.DataAnnotations" Version="2.1.1" />
</ItemGroup> </ItemGroup>

2
samples/BookStore/src/Acme.BookStore.Domain/Book.cs

@ -18,4 +18,4 @@ namespace Acme.BookStore
public float Price { get; set; } public float Price { get; set; }
} }
} }

2
samples/BookStore/src/Acme.BookStore.Domain/BookStoreDomainModule.cs

@ -3,6 +3,7 @@ using Acme.BookStore.Localization.BookStore;
using Acme.BookStore.Settings; using Acme.BookStore.Settings;
using Volo.Abp.Identity; using Volo.Abp.Identity;
using Volo.Abp.Localization; using Volo.Abp.Localization;
using Volo.Abp.Localization.Resources.AbpValidation;
using Volo.Abp.Modularity; using Volo.Abp.Modularity;
using Volo.Abp.Settings; using Volo.Abp.Settings;
using Volo.Abp.VirtualFileSystem; using Volo.Abp.VirtualFileSystem;
@ -23,6 +24,7 @@ namespace Acme.BookStore
{ {
options.Resources options.Resources
.Add<BookStoreResource>("en") .Add<BookStoreResource>("en")
.AddBaseTypes(typeof(AbpValidationResource))
.AddVirtualJson("/Localization/BookStore"); .AddVirtualJson("/Localization/BookStore");
}); });

4
samples/BookStore/src/Acme.BookStore.Domain/Localization/BookStore/en.json

@ -2,10 +2,10 @@
"culture": "en", "culture": "en",
"texts": { "texts": {
"Menu:Home": "Home", "Menu:Home": "Home",
"Menu:BookStore": "Book Store",
"Menu:Books": "Books",
"Welcome": "Welcome", "Welcome": "Welcome",
"LongWelcomeMessage": "Welcome to the application. This is a startup project based on the ABP framework. For more information, visit abp.io.", "LongWelcomeMessage": "Welcome to the application. This is a startup project based on the ABP framework. For more information, visit abp.io.",
"Menu:BookStore": "Book Store",
"Menu:Books": "Books",
"Name": "Name", "Name": "Name",
"Type": "Type", "Type": "Type",
"PublishDate": "Publish Date", "PublishDate": "Publish Date",

4
samples/BookStore/src/Acme.BookStore.Domain/Localization/BookStore/tr.json

@ -2,10 +2,10 @@
"culture": "tr", "culture": "tr",
"texts": { "texts": {
"Menu:Home": "Ana sayfa", "Menu:Home": "Ana sayfa",
"Menu:BookStore": "Kitap Deposu",
"Menu:Books": "Kitaplar",
"Welcome": "Hoşgeldiniz", "Welcome": "Hoşgeldiniz",
"LongWelcomeMessage": "Uygulamaya hoşgeldiniz. Bu, ABP framework'ü üzerine bina edilmiş bir başlangıç projesidir. Daha fazla bilgi için abp.io adresini ziyaret edebilirsiniz.", "LongWelcomeMessage": "Uygulamaya hoşgeldiniz. Bu, ABP framework'ü üzerine bina edilmiş bir başlangıç projesidir. Daha fazla bilgi için abp.io adresini ziyaret edebilirsiniz.",
"Menu:BookStore": "Kitap Mağazası",
"Menu:Books": "Kitaplar",
"Name": "İsim", "Name": "İsim",
"Type": "Tür", "Type": "Tür",
"PublishDate": "Yayınlanma Tarihi", "PublishDate": "Yayınlanma Tarihi",

8
samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Acme.BookStore.EntityFrameworkCore.csproj

@ -12,10 +12,10 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Acme.BookStore.Domain\Acme.BookStore.Domain.csproj" /> <ProjectReference Include="..\Acme.BookStore.Domain\Acme.BookStore.Domain.csproj" />
<PackageReference Include="Volo.Abp.PermissionManagement.EntityFrameworkCore" Version="0.3.4" /> <PackageReference Include="Volo.Abp.PermissionManagement.EntityFrameworkCore" Version="0.3.5" />
<PackageReference Include="Volo.Abp.SettingManagement.EntityFrameworkCore" Version="0.3.4" /> <PackageReference Include="Volo.Abp.SettingManagement.EntityFrameworkCore" Version="0.3.5" />
<PackageReference Include="Volo.Abp.Identity.EntityFrameworkCore" Version="0.3.4" /> <PackageReference Include="Volo.Abp.Identity.EntityFrameworkCore" Version="0.3.5" />
<PackageReference Include="Volo.Abp.EntityFrameworkCore.SqlServer" Version="0.3.4" /> <PackageReference Include="Volo.Abp.EntityFrameworkCore.SqlServer" Version="0.3.5" />
</ItemGroup> </ItemGroup>
</Project> </Project>

9
samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Migrations/20180701195241_Initial.Designer.cs → samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Migrations/20180528221424_Initial.Designer.cs

@ -1,24 +1,25 @@
// <auto-generated /> // <auto-generated />
using System; using System;
using Acme.BookStore.EntityFrameworkCore; using System.Collections.Generic;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Metadata.Internal;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Acme.BookStore.EntityFrameworkCore;
namespace Acme.BookStore.Migrations namespace Acme.BookStore.Migrations
{ {
[DbContext(typeof(BookStoreDbContext))] [DbContext(typeof(BookStoreDbContext))]
[Migration("20180701195241_Initial")] [Migration("20180528221424_Initial")]
partial class Initial partial class Initial
{ {
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("ProductVersion", "2.1.1-rtm-30846") .HasAnnotation("ProductVersion", "2.1.0-preview2-30571")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b =>

1
samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Migrations/20180701195241_Initial.cs → samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Migrations/20180528221424_Initial.cs

@ -1,4 +1,5 @@
using System; using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
namespace Acme.BookStore.Migrations namespace Acme.BookStore.Migrations

2
samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Migrations/20180701195424_Created_Book_Entity.Designer.cs → samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Migrations/20180703184727_Created_Book_Entity.Designer.cs

@ -10,7 +10,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Acme.BookStore.Migrations namespace Acme.BookStore.Migrations
{ {
[DbContext(typeof(BookStoreDbContext))] [DbContext(typeof(BookStoreDbContext))]
[Migration("20180701195424_Created_Book_Entity")] [Migration("20180703184727_Created_Book_Entity")]
partial class Created_Book_Entity partial class Created_Book_Entity
{ {
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)

0
samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Migrations/20180701195424_Created_Book_Entity.cs → samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Migrations/20180703184727_Created_Book_Entity.cs

10
samples/BookStore/src/Acme.BookStore.Web/Acme.BookStore.Web.csproj

@ -18,7 +18,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.1.1" /> <PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.1" />
<PackageReference Include="Serilog.AspNetCore" Version="2.1.1" /> <PackageReference Include="Serilog.AspNetCore" Version="2.1.1" />
<PackageReference Include="Serilog.Sinks.File" Version="4.0.0" /> <PackageReference Include="Serilog.Sinks.File" Version="4.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="2.5.0" /> <PackageReference Include="Swashbuckle.AspNetCore" Version="2.5.0" />
@ -27,10 +27,10 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Acme.BookStore.Application\Acme.BookStore.Application.csproj" /> <ProjectReference Include="..\Acme.BookStore.Application\Acme.BookStore.Application.csproj" />
<ProjectReference Include="..\Acme.BookStore.EntityFrameworkCore\Acme.BookStore.EntityFrameworkCore.csproj" /> <ProjectReference Include="..\Acme.BookStore.EntityFrameworkCore\Acme.BookStore.EntityFrameworkCore.csproj" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic" Version="0.3.4" /> <PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic" Version="0.3.5" />
<PackageReference Include="Volo.Abp.Autofac" Version="0.3.4" /> <PackageReference Include="Volo.Abp.Autofac" Version="0.3.5" />
<PackageReference Include="Volo.Abp.Identity.Web" Version="0.3.4" /> <PackageReference Include="Volo.Abp.Identity.Web" Version="0.3.5" />
<PackageReference Include="Volo.Abp.Account.Web" Version="0.3.4" /> <PackageReference Include="Volo.Abp.Account.Web" Version="0.3.5" />
</ItemGroup> </ItemGroup>
</Project> </Project>

2
samples/BookStore/src/Acme.BookStore.Web/BookStoreWebAutoMapperProfile.cs

@ -6,7 +6,7 @@ namespace Acme.BookStore
{ {
public BookStoreWebAutoMapperProfile() public BookStoreWebAutoMapperProfile()
{ {
//add your custom AutoMapper configuration //Configure your AutoMapper mapping configuration here...
} }
} }
} }

37
samples/BookStore/src/Acme.BookStore.Web/BookStoreWebModule.cs

@ -17,6 +17,8 @@ using Volo.Abp.Account.Web;
using Volo.Abp.AspNetCore.Modularity; using Volo.Abp.AspNetCore.Modularity;
using Volo.Abp.AspNetCore.Mvc; using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc.Localization; using Volo.Abp.AspNetCore.Mvc.Localization;
using Volo.Abp.AspNetCore.Mvc.UI;
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic; using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared; using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared;
using Volo.Abp.Autofac; using Volo.Abp.Autofac;
@ -28,7 +30,9 @@ using Volo.Abp.Identity.Web;
using Volo.Abp.Localization; using Volo.Abp.Localization;
using Volo.Abp.Localization.Resources.AbpValidation; using Volo.Abp.Localization.Resources.AbpValidation;
using Volo.Abp.Modularity; using Volo.Abp.Modularity;
using Volo.Abp.PermissionManagement.Web;
using Volo.Abp.Threading; using Volo.Abp.Threading;
using Volo.Abp.UI;
using Volo.Abp.UI.Navigation; using Volo.Abp.UI.Navigation;
using Volo.Abp.VirtualFileSystem; using Volo.Abp.VirtualFileSystem;
@ -69,34 +73,26 @@ namespace Acme.BookStore
ConfigureNavigationServices(services); ConfigureNavigationServices(services);
ConfigureAutoApiControllers(services); ConfigureAutoApiControllers(services);
ConfigureSwaggerServices(services); ConfigureSwaggerServices(services);
services.AddAssemblyOf<BookStoreWebModule>(); services.AddAssemblyOf<BookStoreWebModule>();
} }
private static void ConfigureAutoMapper(IServiceCollection services) private static void ConfigureDatabaseServices(IServiceCollection services, IConfigurationRoot configuration)
{ {
services.Configure<AbpAutoMapperOptions>(options => services.Configure<DbConnectionOptions>(options =>
{ {
options.AddProfile<BookStoreWebAutoMapperProfile>(validate: true); options.ConnectionStrings.Default = configuration.GetConnectionString("Default");
}); });
}
private static void ConfigureAutoApiControllers(IServiceCollection services) services.Configure<AbpDbContextOptions>(options => { options.UseSqlServer(); });
{
services.Configure<AbpAspNetCoreMvcOptions>(options =>
{
options.ConventionalControllers.Create(typeof(BookStoreApplicationModule).Assembly);
});
} }
private static void ConfigureDatabaseServices(IServiceCollection services, IConfigurationRoot configuration) private static void ConfigureAutoMapper(IServiceCollection services)
{ {
services.Configure<DbConnectionOptions>(options => services.Configure<AbpAutoMapperOptions>(options =>
{ {
options.ConnectionStrings.Default = configuration.GetConnectionString("Default"); options.AddProfile<BookStoreWebAutoMapperProfile>();
}); });
services.Configure<AbpDbContextOptions>(options => { options.UseSqlServer(); });
} }
private static void ConfigureVirtualFileSystem(IServiceCollection services, IHostingEnvironment hostingEnvironment) private static void ConfigureVirtualFileSystem(IServiceCollection services, IHostingEnvironment hostingEnvironment)
@ -106,6 +102,7 @@ namespace Acme.BookStore
services.Configure<VirtualFileSystemOptions>(options => services.Configure<VirtualFileSystemOptions>(options =>
{ {
options.FileSets.ReplaceEmbeddedByPyhsical<BookStoreDomainModule>(Path.Combine(hostingEnvironment.ContentRootPath, "..\\Acme.BookStore.Domain")); options.FileSets.ReplaceEmbeddedByPyhsical<BookStoreDomainModule>(Path.Combine(hostingEnvironment.ContentRootPath, "..\\Acme.BookStore.Domain"));
}); });
} }
} }
@ -139,6 +136,14 @@ namespace Acme.BookStore
}); });
} }
private static void ConfigureAutoApiControllers(IServiceCollection services)
{
services.Configure<AbpAspNetCoreMvcOptions>(options =>
{
options.ConventionalControllers.Create(typeof(BookStoreApplicationModule).Assembly);
});
}
private static void ConfigureSwaggerServices(IServiceCollection services) private static void ConfigureSwaggerServices(IServiceCollection services)
{ {
services.AddSwaggerGen( services.AddSwaggerGen(

2
samples/BookStore/src/Acme.BookStore.Web/Pages/Books/EditModal.cshtml

@ -11,7 +11,7 @@
<abp-modal-header title="@L["Update"].Value"></abp-modal-header> <abp-modal-header title="@L["Update"].Value"></abp-modal-header>
<abp-modal-body> <abp-modal-body>
<abp-input asp-for="Id" /> <abp-input asp-for="Id" />
<abp-form-content/> <abp-form-content />
</abp-modal-body> </abp-modal-body>
<abp-modal-footer buttons="@(AbpModalButtons.Cancel|AbpModalButtons.Save)"></abp-modal-footer> <abp-modal-footer buttons="@(AbpModalButtons.Cancel|AbpModalButtons.Save)"></abp-modal-footer>
</abp-modal> </abp-modal>

2
samples/BookStore/src/Acme.BookStore.Web/Pages/Books/EditModal.cshtml.cs

@ -12,7 +12,7 @@ namespace Acme.BookStore.Pages.Books
[BindProperty] [BindProperty]
public CreateUpdateBookDto Book { get; set; } public CreateUpdateBookDto Book { get; set; }
private readonly IBookAppService _bookAppService; private readonly IBookAppService _bookAppService;
public EditModalModel(IBookAppService bookAppService) public EditModalModel(IBookAppService bookAppService)

16
samples/BookStore/src/Acme.BookStore.Web/Pages/Books/Index.cshtml

@ -23,14 +23,14 @@
<abp-card-body> <abp-card-body>
<abp-table striped-rows="true" id="BooksTable"> <abp-table striped-rows="true" id="BooksTable">
<thead> <thead>
<tr> <tr>
<th>@L["Actions"]</th> <th>@L["Actions"]</th>
<th>@L["Name"]</th> <th>@L["Name"]</th>
<th>@L["Type"]</th> <th>@L["Type"]</th>
<th>@L["PublishDate"]</th> <th>@L["PublishDate"]</th>
<th>@L["Price"]</th> <th>@L["Price"]</th>
<th>@L["CreationTime"]</th> <th>@L["CreationTime"]</th>
</tr> </tr>
</thead> </thead>
</abp-table> </abp-table>
</abp-card-body> </abp-card-body>

6
samples/BookStore/src/Acme.BookStore.Web/Pages/Books/Index.cshtml.cs

@ -1,3 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc.RazorPages;
namespace Acme.BookStore.Pages.Books namespace Acme.BookStore.Pages.Books
@ -6,7 +11,6 @@ namespace Acme.BookStore.Pages.Books
{ {
public void OnGet() public void OnGet()
{ {
} }
} }
} }

4
samples/BookStore/src/Acme.BookStore.Web/Properties/launchSettings.json

@ -3,7 +3,7 @@
"windowsAuthentication": false, "windowsAuthentication": false,
"anonymousAuthentication": true, "anonymousAuthentication": true,
"iisExpress": { "iisExpress": {
"applicationUrl": "http://localhost:54929/", "applicationUrl": "http://localhost:53929/",
"sslPort": 0 "sslPort": 0
} }
}, },
@ -21,7 +21,7 @@
"environmentVariables": { "environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development" "ASPNETCORE_ENVIRONMENT": "Development"
}, },
"applicationUrl": "http://localhost:54932/" "applicationUrl": "http://localhost:53932/"
} }
} }
} }

79
samples/BookStore/src/Acme.BookStore.Web/wwwroot/pages/books/index.js

@ -5,69 +5,44 @@
var createModal = new abp.ModalManager(abp.appPath + 'Books/CreateModal'); var createModal = new abp.ModalManager(abp.appPath + 'Books/CreateModal');
var editModal = new abp.ModalManager(abp.appPath + 'Books/EditModal'); var editModal = new abp.ModalManager(abp.appPath + 'Books/EditModal');
var dataTable = $('#BooksTable').DataTable({ var dataTable = $('#BooksTable').DataTable(abp.libs.datatables.normalizeConfiguration({
order: [[1, "asc"]], order: [[1, "asc"]],
ajax: abp.libs.datatables.createAjax(acme.bookStore.book.getList), ajax: abp.libs.datatables.createAjax(acme.bookStore.book.getList),
columnDefs: [ columnDefs: [
{ {
targets: 0,
data: null,
orderable: false,
autoWidth: false,
defaultContent: '',
rowAction: { rowAction: {
text: '<i class="fa fa-cog"></i> ' + l('Actions') + ' <span class="caret"></span>',
items: items:
[ [
{ {
text: l('Edit'), text: l('Edit'),
visible: function () { return true; }, action: function (data) {
action: function (data) { editModal.open({ id: data.record.id });
editModal.open({ }
id: data.record.id },
}); {
} text: l('Delete'),
confirmMessage: function (data) {
return l('BookDeletionConfirmationMessage', data.record.name);
}, },
{ action: function (data) {
text: l('Delete'), acme.bookStore.book
visible: function () { return true; }, .delete(data.record.id)
confirmMessage: function (data) { .then(function() {
return l('BookDeletionConfirmationMessage', data.record.name); abp.notify.info(l('SuccessfullyDeleted'));
}, dataTable.ajax.reload();
action: function (data) { });
acme.bookStore.book
.delete(data.record.id)
.then(function () {
abp.notify.info(l('SuccessfullyDeleted'));
dataTable.ajax.reload();
});
}
} }
] }
]
} }
}, },
{ { data: "name" },
targets: 1, { data: "type" },
data: "name" { data: "publishDate" },
}, { data: "price" },
{ { data: "creationTime" }
targets: 2,
data: "type"
},
{
targets: 3,
data: "publishDate"
},
{
targets: 4,
data: "price"
},
{
targets: 5,
data: "creationTime"
}
] ]
}); }));
createModal.onResult(function () { createModal.onResult(function () {
dataTable.ajax.reload(); dataTable.ajax.reload();

8
samples/BookStore/test/Acme.BookStore.Application.Tests/Acme.BookStore.Application.Tests.csproj

@ -8,19 +8,19 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\src\Acme.BookStore.Application\Acme.BookStore.Application.csproj" /> <ProjectReference Include="..\..\src\Acme.BookStore.Application\Acme.BookStore.Application.csproj" />
<ProjectReference Include="..\..\src\Acme.BookStore.EntityFrameworkCore\Acme.BookStore.EntityFrameworkCore.csproj" /> <ProjectReference Include="..\..\src\Acme.BookStore.EntityFrameworkCore\Acme.BookStore.EntityFrameworkCore.csproj" />
<PackageReference Include="Volo.Abp.TestBase" Version="0.3.3" /> <PackageReference Include="Volo.Abp.TestBase" Version="0.3.5" />
<PackageReference Include="Volo.Abp.Autofac" Version="0.3.3" /> <PackageReference Include="Volo.Abp.Autofac" Version="0.3.5" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.0" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.2" />
<PackageReference Include="NSubstitute" Version="3.1.0" /> <PackageReference Include="NSubstitute" Version="3.1.0" />
<PackageReference Include="Shouldly" Version="3.0.0" /> <PackageReference Include="Shouldly" Version="3.0.0" />
<PackageReference Include="xunit" Version="2.3.1" /> <PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="xunit.extensibility.execution" Version="2.3.1" /> <PackageReference Include="xunit.extensibility.execution" Version="2.3.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" /> <PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="2.1.0" /> <PackageReference Include="Microsoft.Data.Sqlite" Version="2.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.0" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.1" />
</ItemGroup> </ItemGroup>
</Project> </Project>

6
samples/BookStore/test/Acme.BookStore.Application.Tests/BookAppService_Tests.cs

@ -21,7 +21,9 @@ namespace Acme.BookStore
public async Task Should_Get_List_Of_Books() public async Task Should_Get_List_Of_Books()
{ {
//Act //Act
var result = await _bookAppService.GetListAsync(new PagedAndSortedResultRequestDto()); var result = await _bookAppService.GetListAsync(
new PagedAndSortedResultRequestDto()
);
//Assert //Assert
result.TotalCount.ShouldBeGreaterThan(0); result.TotalCount.ShouldBeGreaterThan(0);
@ -67,4 +69,4 @@ namespace Acme.BookStore
.ShouldContain(err => err.MemberNames.Any(mem => mem == "Name")); .ShouldContain(err => err.MemberNames.Any(mem => mem == "Name"));
} }
} }
} }

4
samples/BookStore/test/Acme.BookStore.Web.Tests/Acme.BookStore.Web.Tests.csproj

@ -12,10 +12,10 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.0" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.2" />
<ProjectReference Include="..\Acme.BookStore.Application.Tests\Acme.BookStore.Application.Tests.csproj" /> <ProjectReference Include="..\Acme.BookStore.Application.Tests\Acme.BookStore.Application.Tests.csproj" />
<ProjectReference Include="..\..\src\Acme.BookStore.Web\Acme.BookStore.Web.csproj" /> <ProjectReference Include="..\..\src\Acme.BookStore.Web\Acme.BookStore.Web.csproj" />
<PackageReference Include="Volo.Abp.AspNetCore.TestBase" Version="0.3.3" /> <PackageReference Include="Volo.Abp.AspNetCore.TestBase" Version="0.3.5" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

Loading…
Cancel
Save