35 lines
1.1 KiB
C#
35 lines
1.1 KiB
C#
using AyCode.Services.SignalRs;
|
|
using FruitBank.Common.Dtos;
|
|
using FruitBank.Common.Server.Interfaces;
|
|
using FruitBank.Common.SignalRs;
|
|
using Nop.Core.Domain.Orders;
|
|
using Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer;
|
|
|
|
namespace Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Controllers;
|
|
|
|
public class CustomOrderSignalREndpoint(FruitBankDbContext ctx) : ICustomOrderSignalREndpointServer
|
|
{
|
|
[SignalR(SignalRTags.GetAllOrderDtos)]
|
|
public async Task<List<OrderDto>> GetAllOrderDtos()
|
|
{
|
|
return await ctx.OrderDtos.GetAll(true).ToListAsync();
|
|
}
|
|
|
|
[SignalR(SignalRTags.GetOrderDtoById)]
|
|
public async Task<OrderDto> GetOrderDtoById(int orderId)
|
|
{
|
|
return await ctx.OrderDtos.GetByIdAsync(orderId);
|
|
}
|
|
|
|
[SignalR(SignalRTags.GetPendingOrderDtos)]
|
|
public async Task<List<OrderDto>> GetPendingOrderDtos()
|
|
{
|
|
return await ctx.OrderDtos.GetAllByOrderStatus(OrderStatus.Pending).ToListAsync();
|
|
}
|
|
|
|
[SignalR(SignalRTags.GetAllByIdList)]
|
|
public async Task<List<OrderDto>> GetAllByIds(int[] orderIds)
|
|
{
|
|
return await ctx.OrderDtos.GetAllByIds(orderIds).ToListAsync();
|
|
}
|
|
} |