Example #1
0
        public ActionResult CreateGarden(GardenCreationViewModel model)
        {
            ActionResult result = View(model);

            if (ModelState.IsValid)
            {
                UserManager userManager = new UserManager();

                Garden garden = new Garden();

                ///using Trent's helper method to get a userID
                garden.UserID            = RetrieveUserId();
                garden.GardenDescription = model.GardenDescription;
                garden.GardenName        = model.GardenName;
                garden.GroupID           = model.GroupID;
                garden.GardenRegion      = model.RegionID.ToString();


                GardenManager gardenManager = new GardenManager();

                if (gardenManager.AddGarden(garden))
                {
                    ViewBag.StatusMessage = "Your garden was created!";
                }

                result = RedirectToAction("Details", "Group", new { id = garden.GroupID });
            }

            return(result);
        }
Example #2
0
        private void populateDummyData()
        {
            Garden garden1 = new Garden(10, 20, "Savitch");

            garden1.AddCharge(123.45);
            garden1.AddCharge(678.90);

            Garden garden2 = new Garden(8.5, 120, "Knuth");

            garden2.AddCharge(45.32);
            garden2.AddCharge(678.90);
            garden2.AddCharge(98.76);

            Garden garden3 = new Garden(54.25, 60, "Winograd");

            garden3.AddCharge(149.32);
            garden3.AddCharge(78.12);
            garden3.AddCharge(150.00);

            gardenManager.AddGarden(garden1);
            gardenManager.AddGarden(garden2);
            gardenManager.AddGarden(garden3);
        }