public static IEnumerable<AllocAnalysisDoorsInProduction> GetProductionNumbersForFactories() { var db = new IstokDoorsDBContext(); var factories = db.usp_GetValidFactoriesFromAllocJournal(); db.usp_FindHowManyDoorsInProductionPerFactory(); foreach (var factory in factories) { db.usp_CalculateQuantityInProduction(factory); } var productionNumbers = db.AllocAnalysisDoorsInProductions.ToList(); return productionNumbers; }