Shady nagy/net6 (#614)
* udated to .net6 * used the .net6 version RC2 * added editconfig. * App core new Scoped Namespaces style. * BlazorAdmin new Scoped Namespaces style. * Blazor Shared new Scoped Namespaces style. * Infra new Scoped Namespaces style. * public api new Scoped Namespaces style. * web new Scoped Namespaces style. * FunctionalTests new Scoped Namespaces style. * Integrational tests new Scoped Namespaces style. * unit tests new Scoped Namespaces style. * update github action. * update github action. * change the global.
This commit is contained in:
@@ -1,16 +1,15 @@
|
||||
using MediatR;
|
||||
using System.Collections.Generic;
|
||||
using MediatR;
|
||||
using Microsoft.eShopWeb.Web.ViewModels;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Microsoft.eShopWeb.Web.Features.MyOrders
|
||||
namespace Microsoft.eShopWeb.Web.Features.MyOrders;
|
||||
|
||||
public class GetMyOrders : IRequest<IEnumerable<OrderViewModel>>
|
||||
{
|
||||
public class GetMyOrders : IRequest<IEnumerable<OrderViewModel>>
|
||||
{
|
||||
public string UserName { get; set; }
|
||||
public string UserName { get; set; }
|
||||
|
||||
public GetMyOrders(string userName)
|
||||
{
|
||||
UserName = userName;
|
||||
}
|
||||
public GetMyOrders(string userName)
|
||||
{
|
||||
UserName = userName;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,45 +1,44 @@
|
||||
using MediatR;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediatR;
|
||||
using Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate;
|
||||
using Microsoft.eShopWeb.ApplicationCore.Interfaces;
|
||||
using Microsoft.eShopWeb.ApplicationCore.Specifications;
|
||||
using Microsoft.eShopWeb.Web.ViewModels;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Microsoft.eShopWeb.Web.Features.MyOrders
|
||||
namespace Microsoft.eShopWeb.Web.Features.MyOrders;
|
||||
|
||||
public class GetMyOrdersHandler : IRequestHandler<GetMyOrders, IEnumerable<OrderViewModel>>
|
||||
{
|
||||
public class GetMyOrdersHandler : IRequestHandler<GetMyOrders, IEnumerable<OrderViewModel>>
|
||||
private readonly IReadRepository<Order> _orderRepository;
|
||||
|
||||
public GetMyOrdersHandler(IReadRepository<Order> orderRepository)
|
||||
{
|
||||
private readonly IReadRepository<Order> _orderRepository;
|
||||
_orderRepository = orderRepository;
|
||||
}
|
||||
|
||||
public GetMyOrdersHandler(IReadRepository<Order> orderRepository)
|
||||
public async Task<IEnumerable<OrderViewModel>> Handle(GetMyOrders request,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
var specification = new CustomerOrdersWithItemsSpecification(request.UserName);
|
||||
var orders = await _orderRepository.ListAsync(specification, cancellationToken);
|
||||
|
||||
return orders.Select(o => new OrderViewModel
|
||||
{
|
||||
_orderRepository = orderRepository;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<OrderViewModel>> Handle(GetMyOrders request,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
var specification = new CustomerOrdersWithItemsSpecification(request.UserName);
|
||||
var orders = await _orderRepository.ListAsync(specification, cancellationToken);
|
||||
|
||||
return orders.Select(o => new OrderViewModel
|
||||
OrderDate = o.OrderDate,
|
||||
OrderItems = o.OrderItems?.Select(oi => new OrderItemViewModel()
|
||||
{
|
||||
OrderDate = o.OrderDate,
|
||||
OrderItems = o.OrderItems?.Select(oi => new OrderItemViewModel()
|
||||
{
|
||||
PictureUrl = oi.ItemOrdered.PictureUri,
|
||||
ProductId = oi.ItemOrdered.CatalogItemId,
|
||||
ProductName = oi.ItemOrdered.ProductName,
|
||||
UnitPrice = oi.UnitPrice,
|
||||
Units = oi.Units
|
||||
}).ToList(),
|
||||
OrderNumber = o.Id,
|
||||
ShippingAddress = o.ShipToAddress,
|
||||
Total = o.Total()
|
||||
});
|
||||
}
|
||||
PictureUrl = oi.ItemOrdered.PictureUri,
|
||||
ProductId = oi.ItemOrdered.CatalogItemId,
|
||||
ProductName = oi.ItemOrdered.ProductName,
|
||||
UnitPrice = oi.UnitPrice,
|
||||
Units = oi.Units
|
||||
}).ToList(),
|
||||
OrderNumber = o.Id,
|
||||
ShippingAddress = o.ShipToAddress,
|
||||
Total = o.Total()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user