public ActionResult Finish(List <int> TrainingArray, int CustomerID, int LocationID)
        {
            IEnumerable <Training> products = RepoP.GetProducts();
            Order viewModel = new Order();

            viewModel.bears = new List <OrderBear>();
            int tester = 0;

            for (int i2 = 0; i2 < TrainingArray.Where(x => x == 0).Count(); i2++)
            {
                OrderBear sbvm = new OrderBear();
                sbvm.upgrades = new List <TrainingContainer>();
                while (TrainingArray[tester] != 0)
                {
                    var p = Mapper.Map(products.First(x => x.ID == TrainingArray[tester]));
                    TrainingContainer st = new TrainingContainer()
                    {
                        Product = Mapper.Map(p)
                    };
                    ;
                    sbvm.AddTraining(st);
                    tester++;
                }
                viewModel.AddBear(sbvm);
                tester++;
            }

            Customer c = RepoC.GetCustomerById(CustomerID);

            viewModel.CustomerID = c.Id;



            Location selectedlocation = RepoL.GetLocationById(LocationID);
            Order    finishedorder    = viewModel;


            selectedlocation.ProcessOrder(finishedorder);
            finishedorder.Location = selectedlocation;
            RepoL.UpdateLocation(selectedlocation);
            RepoO.AddOrder(finishedorder);
            RepoL.Save();
            RepoO.Save();
            return(View());
        }
        public ActionResult SelectL(List <int> TrainingArray, int CustomerID)
        {
            OrderViewModel viewModel = new OrderViewModel();

            Customer c = RepoC.GetCustomerById(CustomerID);

            viewModel.Customer = new CustomerViewModel()
            {
                FirstName = c.FirstName,
                LastName  = c.LastName,
                Id        = c.Id
            };

            IEnumerable <Location> locations = RepoL.GetLocations();

            ViewBag.locationArray = locations.Select(x => x.ID);
            ViewBag.trainingArray = TrainingArray;
            ViewBag.CustomerID    = CustomerID;

            return(View(viewModel));
        }