Skip to content

Commit c85db1f

Browse files
committed
Working on jtable sample project.
1 parent 849502d commit c85db1f

File tree

21 files changed

+317
-99
lines changed

21 files changed

+317
-99
lines changed

AbpWithjTable/AbpjTable.Application/People/IPersonAppService.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
1-
using System.Collections.Generic;
2-
using System.ComponentModel.DataAnnotations.Schema;
3-
using System.Linq;
4-
using System.Text;
5-
using System.Threading.Tasks;
6-
using Abp.Application.Services;
1+
using Abp.Application.Services;
72
using Abp.Application.Services.Dto;
8-
using AbpjTable.Cities;
93
using AbpjTable.People.Dto;
104

115
namespace AbpjTable.People
126
{
13-
public interface IPersonAppService : IApplicationService
7+
public interface IPersonAppService : IApplicationService
148
{
159
PagedResultOutput<PersonDto> GetPeople(GetPeopleInput input);
1610
}

AbpWithjTable/AbpjTable.Application/People/PersonAppService.cs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,34 @@
11
using System.Collections.Generic;
22
using System.Linq;
33
using Abp.Application.Services.Dto;
4-
using Abp.Domain.Repositories;
54
using AbpjTable.People.Dto;
65
using AutoMapper;
76

87
namespace AbpjTable.People
98
{
109
public class PersonAppService : AbpjTableAppServiceBase, IPersonAppService
1110
{
12-
private readonly IRepository<Person> _personRepository;
11+
private readonly IPersonRepository _personRepository;
1312

14-
public PersonAppService(IRepository<Person> personRepository)
13+
public PersonAppService(IPersonRepository personRepository)
1514
{
1615
_personRepository = personRepository;
1716
}
1817

1918
public PagedResultOutput<PersonDto> GetPeople(GetPeopleInput input)
2019
{
21-
var personListQuery = _personRepository.GetAll()
22-
.OrderBy(p => p.Name)
20+
var personListQuery = _personRepository.GetAllIncludingBirthCity();
21+
22+
var totalCount = personListQuery.Count();
23+
var personList = personListQuery.OrderBy(p => p.Name)
2324
.Skip(input.SkipCount)
24-
.Take(input.MaxResultCount);
25+
.Take(input.MaxResultCount)
26+
.ToList();
2527

2628
return new PagedResultOutput<PersonDto>
2729
{
28-
TotalCount = personListQuery.Count(),
29-
Items = Mapper.Map<List<PersonDto>>(personListQuery.ToList())
30+
TotalCount = totalCount,
31+
Items = Mapper.Map<List<PersonDto>>(personList)
3032
};
3133
}
3234
}

AbpWithjTable/AbpjTable.Core/AbpjTable.Core.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
<Compile Include="AbpjTableConsts.cs" />
6464
<Compile Include="AbpjTableCoreModule.cs" />
6565
<Compile Include="Cities\City.cs" />
66+
<Compile Include="People\IPersonRepository.cs" />
6667
<Compile Include="People\Person.cs" />
6768
<Compile Include="Properties\AssemblyInfo.cs" />
6869
</ItemGroup>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using System.Linq;
2+
using Abp.Domain.Repositories;
3+
4+
namespace AbpjTable.People
5+
{
6+
public interface IPersonRepository : IRepository<Person>
7+
{
8+
IQueryable<Person> GetAllIncludingBirthCity();
9+
}
10+
}

AbpWithjTable/AbpjTable.EntityFramework/AbpjTable.EntityFramework.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
<ItemGroup>
7878
<Compile Include="EntityFramework\AbpjTableDbContext.cs" />
7979
<Compile Include="EntityFramework\Repositories\AbpjTableRepositoryBase.cs" />
80+
<Compile Include="EntityFramework\Repositories\PersonRepository.cs" />
8081
<Compile Include="Migrations\201410241939445_InitialCreate.cs" />
8182
<Compile Include="Migrations\201410241939445_InitialCreate.Designer.cs">
8283
<DependentUpon>201410241939445_InitialCreate.cs</DependentUpon>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using System.Data.Entity;
2+
using System.Linq;
3+
using AbpjTable.People;
4+
5+
namespace AbpjTable.EntityFramework.Repositories
6+
{
7+
internal class PersonRepository : AbpjTableRepositoryBase<Person>, IPersonRepository
8+
{
9+
public IQueryable<Person> GetAllIncludingBirthCity()
10+
{
11+
return GetAll().Include(p => p.BirthCity);
12+
}
13+
}
14+
}

AbpWithjTable/AbpjTable.EntityFramework/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
[assembly: AssemblyCopyright("Copyright © 2014")]
1414
[assembly: AssemblyTrademark("")]
1515
[assembly: AssemblyCulture("")]
16+
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
1617

1718
// Setting ComVisible to false makes the types in this assembly not visible
1819
// to COM components. If you need to access a type in this assembly from

AbpWithjTable/AbpjTable.Web/AbpjTable.Web.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,8 @@
185185
</Content>
186186
<Content Include="App\Main\views\layout\header.js" />
187187
<Content Include="App\Main\views\layout\layout.js" />
188-
<Content Include="App\Main\views\home\home.js" />
189-
<Content Include="App\Main\views\about\about.js" />
188+
<Content Include="App\Main\views\people\people.js" />
189+
<Content Include="App\Main\views\cities\cities.js" />
190190
<Content Include="Content\bootstrap-cosmo.min.css" />
191191
<Content Include="Content\bootstrap-theme.css" />
192192
<Content Include="Content\bootstrap-theme.min.css" />
@@ -274,8 +274,8 @@
274274
<Content Include="Content\toastr.less" />
275275
<Content Include="App\Main\main.less" />
276276
<Content Include="App\Main\views\layout\layout.cshtml" />
277-
<Content Include="App\Main\views\home\home.cshtml" />
278-
<Content Include="App\Main\views\about\about.cshtml" />
277+
<Content Include="App\Main\views\people\people.cshtml" />
278+
<Content Include="App\Main\views\cities\cities.cshtml" />
279279
<Content Include="App\Main\web.config" />
280280
<Content Include="log4net.config" />
281281
<Content Include="Scripts\angular.js" />

AbpWithjTable/AbpjTable.Web/App/Main/app.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@
1818
function($stateProvider, $urlRouterProvider) {
1919
$urlRouterProvider.otherwise('/');
2020
$stateProvider
21-
.state('home', {
21+
.state('people', {
2222
url: '/',
23-
templateUrl: '/App/Main/views/home/home.cshtml',
24-
menu: 'Home' //Matches to name of 'Home' menu in AbpjTableNavigationProvider
23+
templateUrl: '/App/Main/views/people/people.cshtml',
24+
menu: 'People'
2525
})
26-
.state('about', {
27-
url: '/about',
28-
templateUrl: '/App/Main/views/about/about.cshtml',
29-
menu: 'About' //Matches to name of 'About' menu in AbpjTableNavigationProvider
26+
.state('cities', {
27+
url: '/cities',
28+
templateUrl: '/App/Main/views/cities/cities.cshtml',
29+
menu: 'Cities'
3030
});
3131
}
3232
]);

AbpWithjTable/AbpjTable.Web/App/Main/libs/abp.jtable.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
.done(function (data) {
4444
$dfd.resolve({
4545
"Result": "OK",
46-
"Records": data[originalListAction.recordsField],
46+
"Records": data[originalListAction.recordsField || 'items'],
4747
"TotalRecordCount": data.totalCount //TODO: Make an Interface to standardize totalCount
4848
});
4949
})

0 commit comments

Comments
 (0)