Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }