using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Web; using System.Reflection; namespace Weee.Models.ExtensionMethods { public static class MaterialExtension { public static decimal GetTotalPartsCarbonFootprint(this ICollection materials) where T : Material { decimal totalPartsCarbonFootprint = 0; foreach (var material in materials) { if (material.RequestSent == null || material.RequestSent.RepliedByWhichLCA == null) continue; totalPartsCarbonFootprint += material.RequestSent.RepliedByWhichLCA.GetPrimaryAndSecondaryFabKgCO2e(); } return totalPartsCarbonFootprint; } } }