Skip to content

Commit

Permalink
#6348 Refactor GetWareHouseByIdAsync method
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisClaude committed Sep 25, 2022
1 parent f400300 commit b17b0a8
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 24 deletions.
10 changes: 0 additions & 10 deletions src/Libraries/Nop.Services/Catalog/IProductService.cs
Expand Up @@ -877,16 +877,6 @@ public partial interface IProductService
/// <returns>A task that represents the asynchronous operation</returns>
Task<IList<ProductWarehouseInventory>> GetAllProductWarehouseInventoryRecordsAsync(int productId);

/// <summary>
/// Gets a warehouse by identifier
/// </summary>
/// <param name="warehouseId">Warehouse identifier</param>
/// <returns>
/// A task that represents the asynchronous operation
/// The task result contains the result
/// </returns>
Task<Warehouse> GetWarehouseByIdAsync(int warehouseId);

/// <summary>
/// Deletes a ProductWarehouseInventory
/// </summary>
Expand Down
13 changes: 0 additions & 13 deletions src/Libraries/Nop.Services/Catalog/ProductService.cs
Expand Up @@ -2662,19 +2662,6 @@ public virtual async Task<IList<ProductWarehouseInventory>> GetAllProductWarehou
return await _productWarehouseInventoryRepository.GetAllAsync(query => query.Where(pwi => pwi.ProductId == productId));
}

/// <summary>
/// Gets a warehouse by identifier
/// </summary>
/// <param name="warehouseId">Warehouse identifier</param>
/// <returns>
/// A task that represents the asynchronous operation
/// The task result contains the result
/// </returns>
public virtual async Task<Warehouse> GetWarehouseByIdAsync(int warehouseId)
{
return await _warehouseRepository.GetByIdAsync(warehouseId, cache => default);
}

/// <summary>
/// Deletes a record to manage product inventory per warehouse
/// </summary>
Expand Down
Expand Up @@ -1569,7 +1569,7 @@ public virtual async Task<ShipmentListModel> PrepareShipmentListModelAsync(Shipm
shipmentItemModel.AllowToChooseWarehouse = true;
foreach (var pwi in (await _productService.GetAllProductWarehouseInventoryRecordsAsync(orderItem.ProductId)).OrderBy(w => w.WarehouseId).ToList())
{
if (await _productService.GetWarehouseByIdAsync(pwi.WarehouseId) is Warehouse warehouse)
if (await _shippingService.GetWarehouseByIdAsync(pwi.WarehouseId) is Warehouse warehouse)
{
shipmentItemModel.AvailableWarehouses.Add(new ShipmentItemModel.WarehouseInfo
{
Expand Down

0 comments on commit b17b0a8

Please sign in to comment.