Services/GoodsService/ApplicationService/GoodsCategoryQueryService.cs
(完整代码) 1KBusing IApplicationService;
using IApplicationService.Base.AppQuery;
using IApplicationService.GoodsCategoryService;
using Infrastructure.EfDataAccess;
using Infrastructure.PersistenceObject;
using InfrastructureBase.AuthBase;
using InfrastructureBase.Data;
using InfrastructureBase.Object;
using Microsoft.EntityFrameworkCore;
using Oxygen.Client.ServerProxyFactory.Interface;
using System.Linq;
using System.Threading.Tasks;
namespace ApplicationService
{
public class GoodsCategoryQueryService : IGoodsCategoryQueryService
{
private readonly EfDbContext dbContext;
private readonly IStateManager stateManager;
public GoodsCategoryQueryService(EfDbContext dbContext, IStateManager stateManager)
{
this.dbContext = dbContext;
this.stateManager = stateManager;
}
public async Task<ApiResult> GetAllCategoryList()
{
var query = from category in dbContext.GoodsCategory orderby category.Sort select new { category.Id, category.CategoryName };
return await ApiResult.Ok(query.ToListAsync()).Async();
}
[AuthenticationFilter]
public async Task<ApiResult> GetCategoryList(PageQueryInputBase input)
{
var query = from category in dbContext.GoodsCategory orderby category.Sort select category;
var (Data, Total) = await QueryServiceHelper.PageQuery(query, input.Page, input.Limit);
return ApiResult.Ok(new PageQueryResonseBase<GoodsCategory>(Data, Total));
}
}
}
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
