Example #1
0
        public bool MoveExhibit(double oldX, double oldY, double newX, double newY)
        {
            var oldExhibit = GetExhibit(oldX, oldY);
            var problem    = IsProblemToBuild(newX, newY);

            if (oldExhibit == null || problem)
            {
                return(false);
            }
            var equipment  = oldExhibit.GetEquipment();
            var newExhibit = new Exhibit(newX, newY, equipment);
            var animals    = oldExhibit.GetAnimals();

            foreach (var animal in animals)
            {
                newExhibit.AddAnimal(animal);
            }
            RegisterExhibit(newExhibit);
            RemoveExhibit(ref oldExhibit);
            return(true);
        }
Example #2
0
 private void RegisterExhibit(Exhibit newExhibit)
 {
     // would be some database INSERT
     exhibits.Add(newExhibit);
 }
Example #3
0
 private void RemoveExhibit(ref Exhibit exhibit)
 {
     exhibits.Remove(exhibit);
     exhibit = null; //destroyed
 }