improvements, fixes, etc...
This commit is contained in:
parent
91f270526e
commit
540c59d7c4
|
|
@ -38,12 +38,10 @@ namespace Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Controllers
|
|||
}
|
||||
|
||||
#region CustomOrderSignalREndpoint
|
||||
public Task<List<OrderDto>> GetAllOrderDtos()
|
||||
=> _customOrderSignalREndpoint.GetAllOrderDtos();
|
||||
public Task<OrderDto> GetOrderDtoById(int orderId)
|
||||
=> _customOrderSignalREndpoint.GetOrderDtoById(orderId);
|
||||
public Task<List<OrderDto>> GetPendingOrderDtos()
|
||||
=> _customOrderSignalREndpoint.GetPendingOrderDtos();
|
||||
[NonAction] public Task<List<OrderDto>> GetAllOrderDtos() => _customOrderSignalREndpoint.GetAllOrderDtos();
|
||||
[NonAction]public Task<OrderDto> GetOrderDtoById(int orderId) => _customOrderSignalREndpoint.GetOrderDtoById(orderId);
|
||||
[NonAction]public Task<List<OrderDto>> GetPendingOrderDtos() => _customOrderSignalREndpoint.GetPendingOrderDtos();
|
||||
[NonAction] public Task<List<OrderDto>> GetAllByIds(int[] orderIds) => _customOrderSignalREndpoint.GetAllByIds(orderIds);
|
||||
#endregion CustomOrderSignalREndpoint
|
||||
|
||||
[CheckPermission(StandardPermission.Orders.ORDERS_VIEW)]
|
||||
|
|
@ -86,16 +84,6 @@ namespace Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Controllers
|
|||
return orderListModel;
|
||||
}
|
||||
|
||||
public async Task<OrderListModelExtended> GetPendingOrderListModel()
|
||||
{
|
||||
var orderSearchModel = new OrderSearchModel
|
||||
{
|
||||
OrderStatusIds = new List<int> { (int)OrderStatus.Pending }
|
||||
};
|
||||
|
||||
return await GetOrderListModelByFilter(orderSearchModel);
|
||||
}
|
||||
|
||||
public virtual IActionResult Test()
|
||||
{
|
||||
// Your custom logic here
|
||||
|
|
|
|||
|
|
@ -12,18 +12,25 @@ public class CustomOrderSignalREndpoint(FruitBankDbContext ctx) : ICustomOrderSi
|
|||
[SignalR(SignalRTags.GetAllOrderDtos)]
|
||||
public async Task<List<OrderDto>> GetAllOrderDtos()
|
||||
{
|
||||
return await ctx.OrderDtos.GetAllDtos().ToListAsync();
|
||||
return await ctx.OrderDtos.GetAll(true).ToListAsync();
|
||||
}
|
||||
|
||||
[SignalR(SignalRTags.GetOrderDtoById)]
|
||||
public async Task<OrderDto> GetOrderDtoById(int orderId)
|
||||
{
|
||||
return await ctx.OrderDtos.GetDtoByIdAsync(orderId);
|
||||
return await ctx.OrderDtos.GetByIdAsync(orderId);
|
||||
}
|
||||
|
||||
[SignalR(SignalRTags.GetPendingOrderDtos)]
|
||||
public async Task<List<OrderDto>> GetPendingOrderDtos()
|
||||
{
|
||||
return await ctx.OrderDtos.GetAllByStatusDto(OrderStatus.Pending).ToListAsync();
|
||||
return await ctx.OrderDtos.GetAllByStatus(OrderStatus.Pending).ToListAsync();
|
||||
}
|
||||
|
||||
[SignalR(SignalRTags.GetAllByIdList)]
|
||||
public async Task<List<OrderDto>> GetAllByIds(int[] orderIds)
|
||||
{
|
||||
return await ctx.OrderDtos.GetAllByIds(orderIds).ToListAsync();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -19,20 +19,25 @@ public class OrderDtoDbTable : MgDbTableBase<OrderDto>
|
|||
{
|
||||
}
|
||||
|
||||
public IQueryable<OrderDto> GetAllDtos()
|
||||
public IQueryable<OrderDto> GetAll(bool loadRelations)
|
||||
{
|
||||
return GetAll()
|
||||
.LoadWith(o => o.GenericAttributes)
|
||||
.LoadWith(o => o.OrderItemDtos).ThenLoad(oi => oi.ProductDto)
|
||||
.LoadWith(o => o.OrderItemDtos).ThenLoad(oi => oi.ProductDto).ThenLoad(prod=>prod.GenericAttributes)
|
||||
.LoadWith(o => o.OrderItemDtos).ThenLoad(oi => oi.GenericAttributes)
|
||||
.LoadWith(o => o.OrderItemDtos).ThenLoad(oi => oi.OrderItemPallets);
|
||||
}
|
||||
|
||||
public Task<OrderDto> GetDtoByIdAsync(int orderId)
|
||||
public Task<OrderDto> GetByIdAsync(int orderId)
|
||||
{
|
||||
return GetAllDtos().Where(x => x.Id == orderId).FirstOrDefaultAsync(null);
|
||||
return GetAll(true).Where(x => x.Id == orderId).FirstOrDefaultAsync(null);
|
||||
}
|
||||
|
||||
public IQueryable<OrderDto> GetAllByStatusDto(OrderStatus orderStatus)
|
||||
=> GetAllDtos().Where(o => o.OrderStatusId == (int)orderStatus);
|
||||
public IQueryable<OrderDto> GetAllByStatus(OrderStatus orderStatus)
|
||||
=> GetAll(true).Where(o => o.OrderStatusId == (int)orderStatus);
|
||||
|
||||
public IQueryable<OrderDto> GetAllByIds(IEnumerable<int> orderIds)
|
||||
{
|
||||
return GetAll(true).Where(o => orderIds.Contains(o.Id));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue