Browse Source

Merge pull request #142 from abpframework/eshop-anonymous-issue

Removed unnecessary [AllowAnonymous]
gterdem/swagger_update
Galip Tolga Erdem 3 years ago
committed by GitHub
parent
commit
ca32f0dac9
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      services/ordering/src/EShopOnAbp.OrderingService.Application/Orders/OrderAppService.cs

11
services/ordering/src/EShopOnAbp.OrderingService.Application/Orders/OrderAppService.cs

@ -37,14 +37,8 @@ public class OrderAppService : ApplicationService, IOrderAppService
return CreateOrderDtoMapping(order);
}
[AllowAnonymous]
public async Task<List<OrderDto>> GetMyOrdersAsync(GetMyOrdersInput input)
{
if (CurrentUser.Id == null)
{
return new List<OrderDto>();
}
ISpecification<Order> specification = SpecificationFactory.Create(input.Filter);
var orders = await _orderRepository.GetOrdersByUserId(CurrentUser.GetId(), specification, true);
return CreateOrderDtoMapping(orders);
@ -78,6 +72,7 @@ public class OrderAppService : ApplicationService, IOrderAppService
Payments = await GetPercentOfTotalPaymentAsync(input.Filter)
};
}
private async Task<List<TopSellingDto>> GetTopSellingAsync(string filter)
{
ISpecification<Order> specification = SpecificationFactory.Create(filter);
@ -99,7 +94,6 @@ public class OrderAppService : ApplicationService, IOrderAppService
return CreateOrderStatusDtoMapping(orders);
}
[AllowAnonymous]
public async Task<OrderDto> GetByOrderNoAsync(int orderNo)
{
var order = await _orderRepository.GetByOrderNoAsync(orderNo);
@ -122,7 +116,6 @@ public class OrderAppService : ApplicationService, IOrderAppService
await _orderRepository.UpdateAsync(order);
}
[AllowAnonymous]
public async Task<OrderDto> CreateAsync(OrderCreateDto input)
{
var orderItems = GetProductListTuple(input.Products);
@ -211,7 +204,7 @@ public class OrderAppService : ApplicationService, IOrderAppService
var topSetlling = orderItems
.GroupBy(p => p.ProductId)
.Select(p => new TopSellingDto { Units = p.Count(), ProductName = p.First().ProductName , PictureUrl = p.First().PictureUrl })
.Select(p => new TopSellingDto { Units = p.Count(), ProductName = p.First().ProductName, PictureUrl = p.First().PictureUrl })
.OrderByDescending(p => p.Units)
.Take(OrderConstants.Top10).ToList();

Loading…
Cancel
Save