public FactoryAmount GetFactoryAmount(Guid id) { FactoryAmount factoryAmount = FactoryAmounts.SingleOrDefault(x => x.Factory.id == id); if (factoryAmount == null) { throw new ArgumentException(string.Format("FactoryAmount could not be found with ID: {0}", id)); } return(factoryAmount); }
internal Factory AddFactory(Factory factory) { if (FactoryAmounts.Where(x => x.Factory.id == factory.id).Count() == 0) { FactoryAmounts.Add(new FactoryAmount(factory, 1)); SortFactoryAmounts(); return(factory); } FactoryAmount factoryAmount = FactoryAmounts.Single(x => x.Factory.id == factory.id); factoryAmount.Count++; return(factory); }