29 lines
959 B
C#
29 lines
959 B
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.GetAllDtos().ToListAsync();
|
|
}
|
|
|
|
[SignalR(SignalRTags.GetOrderDtoById)]
|
|
public async Task<OrderDto> GetOrderDtoById(int orderId)
|
|
{
|
|
return await ctx.OrderDtos.GetDtoByIdAsync(orderId);
|
|
}
|
|
|
|
[SignalR(SignalRTags.GetPendingOrderDtos)]
|
|
public async Task<List<OrderDto>> GetPendingOrderDtos()
|
|
{
|
|
return await ctx.OrderDtos.GetAllByStatusDto(OrderStatus.Pending).ToListAsync();
|
|
}
|
|
} |