mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-09-18 17:48:01 +08:00
check bugs
This commit is contained in:
@@ -105,6 +105,7 @@
|
||||
<Compile Include="AutofacExt.cs" />
|
||||
<Compile Include="BaseApp.cs" />
|
||||
<Compile Include="AuthorizeApp.cs" />
|
||||
<Compile Include="ResourceApp.cs" />
|
||||
<Compile Include="CategoryApp.cs" />
|
||||
<Compile Include="Define.cs" />
|
||||
<Compile Include="Flow\FlowRuntime.cs" />
|
||||
@@ -114,6 +115,7 @@
|
||||
<Compile Include="FormApp.cs" />
|
||||
<Compile Include="Request\IdPageReq.cs" />
|
||||
<Compile Include="Request\PageReq.cs" />
|
||||
<Compile Include="Request\QueryResourcesReq.cs" />
|
||||
<Compile Include="Request\QueryCategoriesReq.cs" />
|
||||
<Compile Include="Request\QueryFlowInstanceListReq.cs" />
|
||||
<Compile Include="Request\QueryFlowSchemeListReq.cs" />
|
||||
|
11
OpenAuth.App/Request/QueryResourcesReq.cs
Normal file
11
OpenAuth.App/Request/QueryResourcesReq.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace OpenAuth.App.Request
|
||||
{
|
||||
public class QueryResourcesReq : PageReq
|
||||
{
|
||||
/// <summary>
|
||||
/// TypeID
|
||||
/// </summary>
|
||||
public string TypeId { get; set; }
|
||||
|
||||
}
|
||||
}
|
59
OpenAuth.App/ResourceApp.cs
Normal file
59
OpenAuth.App/ResourceApp.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenAuth.App.Request;
|
||||
using OpenAuth.App.Response;
|
||||
using OpenAuth.Repository.Domain;
|
||||
|
||||
namespace OpenAuth.App
|
||||
{
|
||||
/// <summary>
|
||||
/// 分类管理
|
||||
/// </summary>
|
||||
public class ResourceApp:BaseApp<Resource>
|
||||
{
|
||||
|
||||
public IEnumerable<Resource> Get(string type)
|
||||
{
|
||||
return Repository.Find(u => u.TypeId == type);
|
||||
}
|
||||
|
||||
public void Add(Resource resource)
|
||||
{
|
||||
if (string.IsNullOrEmpty(resource.Id))
|
||||
{
|
||||
resource.Id = Guid.NewGuid().ToString();
|
||||
}
|
||||
Repository.Add(resource);
|
||||
}
|
||||
|
||||
public void Update(Resource resource)
|
||||
{
|
||||
Repository.Update(u =>u.Id,resource);
|
||||
}
|
||||
|
||||
|
||||
public TableData All(QueryResourcesReq request)
|
||||
{
|
||||
var result = new TableData();
|
||||
var resources = UnitWork.Find<Resource>(null) ;
|
||||
if (!string.IsNullOrEmpty(request.key))
|
||||
{
|
||||
resources = resources.Where(u => u.Name.Contains(request.key) || u.Id.Contains(request.key));
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(request.TypeId))
|
||||
{
|
||||
resources = resources.Where(u => u.TypeId == request.TypeId);
|
||||
}
|
||||
|
||||
|
||||
result.data = resources.OrderBy(u => u.TypeId)
|
||||
.Skip((request.page - 1) * request.limit)
|
||||
.Take(request.limit).ToList();
|
||||
result.count = resources.Count();
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user