Esempio n. 1
0
        public void DeactivateGardenLocation(GardenLocation gardenLocation)
        {
            GardenLocation myGarden = GetGardenLocation(gardenLocation.postCode);

            _context.GardenLocation.Remove(myGarden);

            _context.SaveChanges();
        }
Esempio n. 2
0
        public void editGardenLocation(GardenLocation gardenLocation)
        {
            GardenLocation mygarden = GetGardenLocation(gardenLocation.postCode);

            mygarden.Name  = gardenLocation.Name;
            mygarden.Owner = gardenLocation.Owner;

            _context.SaveChanges();
        }
Esempio n. 3
0
        public ActionResult AddGardenLocation(GardenLocation garden, Allotment allotment)
        {
            try
            {
                _gardenService.addGardenLocation(garden, allotment);

                //Allocates the most recent garden
                _gardenService.AllocateGarden();


                return(RedirectToAction("Gardens", new { controller = "Garden" }));
            }
            catch (Exception ex)
            {
                // Might be worth looking at redirection to an error page
                ViewBag.Exception = ex;
                return(View());
            }
        }
Esempio n. 4
0
        public ActionResult DeactivateGardenLocation(GardenLocation location, string pcode)
        {
            GardenLocation gardenLocation = new GardenLocation
            {
                Active = false
            };

            _gardenService.DeactivateGardenLocation(location);

            var gardens = _gardenService.ListGardensbyPostCode(pcode);

            foreach (var garden in gardens)
            {
                AllotmentAllocation myAllotmentAllocation = new AllotmentAllocation
                {
                    dateTo = DateTime.Now
                };

                _gardenService.removeGardenerFromGarden(myAllotmentAllocation);
            }

            return(RedirectToAction("Gardens", new { controller = "Garden" }));
        }
Esempio n. 5
0
        public ActionResult editGardenLocation(GardenLocation location)
        {
            {
                try
                {
                    GardenLocation mygardenLocation = new GardenLocation
                    {
                        postCode = location.postCode,
                        Name     = location.Name,
                        Owner    = location.Owner
                    };

                    _gardenService.editGardenLocation(mygardenLocation);

                    return(RedirectToAction("Gardens", new { controller = "Garden" }));
                }
                catch (Exception ex)
                {
                    //  Might be worth looking at redirection to an error page
                    ViewBag.Exception = ex;
                    return(View());
                }
            }
        }
Esempio n. 6
0
 public void addGardenLocation(GardenLocation gardenLocation, Allotment allotment)
 {
     _context.GardenLocation.Add(gardenLocation);
     _context.Allotment.Add(allotment);
     _context.SaveChanges();
 }
Esempio n. 7
0
 public void addGardenLocation(GardenLocation gardenLocation, Allotment allotment)
 {
     _gardenDAO.addGardenLocation(gardenLocation, allotment);
 }
Esempio n. 8
0
 public void DeactivateGardenLocation(GardenLocation gardenLocation)
 {
     _gardenDAO.DeactivateGardenLocation(gardenLocation);
 }
Esempio n. 9
0
 public void editGardenLocation(GardenLocation gardenLocation)
 {
     _gardenDAO.editGardenLocation(gardenLocation);
 }