diff --git a/FurnitureAssembly/FurnitureAssemblyBusinessLogic/ReportLogic.cs b/FurnitureAssembly/FurnitureAssemblyBusinessLogic/ReportLogic.cs
index 4282150..a995780 100644
--- a/FurnitureAssembly/FurnitureAssemblyBusinessLogic/ReportLogic.cs
+++ b/FurnitureAssembly/FurnitureAssemblyBusinessLogic/ReportLogic.cs
@@ -14,18 +14,16 @@ using System.Threading.Tasks;
namespace FurnitureAssemblyBusinessLogic
{
public class ReportLogic : IReportLogic
- {
- private readonly IComponentStorage _componentStorage;
+ {
private readonly IFurnitureStorage _furnitureStorage;
private readonly IOrderStorage _orderStorage;
private readonly AbstractSaveToExcel _saveToExcel;
private readonly AbstractSaveToWord _saveToWord;
private readonly AbstractSaveToPdf _saveToPdf;
- public ReportLogic(IFurnitureStorage furnitureStorage, IComponentStorage componentStorage, IOrderStorage orderStorage,
+ public ReportLogic(IFurnitureStorage furnitureStorage, IOrderStorage orderStorage,
AbstractSaveToExcel saveToExcel, AbstractSaveToWord saveToWord, AbstractSaveToPdf saveToPdf)
{
_furnitureStorage = furnitureStorage;
- _componentStorage = componentStorage;
_orderStorage = orderStorage;
_saveToExcel = saveToExcel;
_saveToWord = saveToWord;
@@ -37,8 +35,7 @@ namespace FurnitureAssemblyBusinessLogic
///
public List GetFurnitureComponent()
{
- var furnitures = _furnitureStorage.GetFullList();
- var components = _componentStorage.GetFullList();
+ var furnitures = _furnitureStorage.GetFullList();
var list = new List();
foreach (var furniture in furnitures)
{
@@ -48,13 +45,10 @@ namespace FurnitureAssemblyBusinessLogic
Components = new List>(),
TotalCount = 0
};
- foreach (var component in components)
- {
- if (furniture.FurnitureComponents.ContainsKey(component.Id))
- {
- record.Components.Add(new Tuple(component.ComponentName, furniture.FurnitureComponents[component.Id].Item2));
- record.TotalCount += furniture.FurnitureComponents[component.Id].Item2;
- }
+ foreach (var componentCount in furniture.FurnitureComponents.Values)
+ {
+ record.Components.Add(new Tuple(componentCount.Item1.ComponentName, componentCount.Item2));
+ record.TotalCount += componentCount.Item2;
}
list.Add(record);
}