添加Category

This commit is contained in:
yubaolee
2015-12-15 23:04:20 +08:00
parent 999046f887
commit f79e5c08fa
15 changed files with 1083 additions and 575 deletions

View File

@@ -0,0 +1,39 @@
using System.Collections.Generic;
using System.Linq;
using OpenAuth.Domain;
using OpenAuth.Domain.Interface;
namespace OpenAuth.Repository
{
public class CategoryRepository :BaseRepository<Category>, ICategoryRepository
{
public IEnumerable<Category> LoadCategorys(int pageindex, int pagesize)
{
return Context.Categories.OrderBy(u => u.Id).Skip((pageindex - 1) * pagesize).Take(pagesize);
}
public IEnumerable<Category> LoadInOrgs(params int[] orgId)
{
var result = from category in Context.Categories where orgId.Contains(category.Id)
select category;
return result;
}
public int GetCategoryCntInOrgs(params int[] orgIds)
{
return LoadInOrgs(orgIds).Count();
}
public IEnumerable<Category> LoadInOrgs(int pageindex, int pagesize, params int[] orgIds)
{
return LoadInOrgs(orgIds).OrderBy(u =>u.Id).Skip((pageindex -1)*pagesize).Take(pagesize);
}
public void Delete(int id)
{
Delete(u =>u.Id == id);
}
}
}

View File

@@ -72,6 +72,7 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ModuleRepository.cs" />
<Compile Include="RoleRepository.cs" />
<Compile Include="CategoryRepository.cs" />
<Compile Include="UserRepository.cs" />
<Compile Include="RelevanceRepository.cs" />
</ItemGroup>