public void DeactivateGardenLocation(GardenLocation gardenLocation) { GardenLocation myGarden = GetGardenLocation(gardenLocation.postCode); _context.GardenLocation.Remove(myGarden); _context.SaveChanges(); }
public void editGardenLocation(GardenLocation gardenLocation) { GardenLocation mygarden = GetGardenLocation(gardenLocation.postCode); mygarden.Name = gardenLocation.Name; mygarden.Owner = gardenLocation.Owner; _context.SaveChanges(); }
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()); } }
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" })); }
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()); } } }
public void addGardenLocation(GardenLocation gardenLocation, Allotment allotment) { _context.GardenLocation.Add(gardenLocation); _context.Allotment.Add(allotment); _context.SaveChanges(); }
public void addGardenLocation(GardenLocation gardenLocation, Allotment allotment) { _gardenDAO.addGardenLocation(gardenLocation, allotment); }
public void DeactivateGardenLocation(GardenLocation gardenLocation) { _gardenDAO.DeactivateGardenLocation(gardenLocation); }
public void editGardenLocation(GardenLocation gardenLocation) { _gardenDAO.editGardenLocation(gardenLocation); }