public void removeGardenerFromGarden(AllotmentAllocation allotmentAllocation) { AllotmentAllocation myAlloction = GetAllocatedAllotment(allotmentAllocation.gardenId); myAlloction.dateTo = allotmentAllocation.dateTo; _context.SaveChanges(); }
//Methods for adding and removing Gardeners from garden public void assignGardenerToGarden(AllotmentAllocation allotmentAllocation) { AllotmentAllocation myAlloction = GetAllocatedAllotment(allotmentAllocation.gardenId); myAlloction.userId = allotmentAllocation.userId; myAlloction.dateFrom = allotmentAllocation.dateFrom; _context.SaveChanges(); }
public void AllocateGarden() { int gardenId = GetLastGardenId(); AllotmentAllocation myallotmentAllocation = new AllotmentAllocation { gardenId = gardenId }; _context.AllotmentAllocation.Add(myallotmentAllocation); _context.SaveChanges(); }
public ActionResult RemoveGardenerfromGarden(int gardenId, AllotmentAllocation allotmentAllocation, GardenViewModel gardenViewModel) { try { AllotmentAllocation myallotmentAllocation = new AllotmentAllocation { gardenId = gardenId, dateTo = DateTime.Now }; _gardenService.removeGardenerFromGarden(myallotmentAllocation); 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 AssignGardenertoGarden(int gardenId, AllotmentAllocation allotmentAllocation) { try { AllotmentAllocation myallotmentAllocation = new AllotmentAllocation { userId = allotmentAllocation.userId, gardenId = gardenId, dateFrom = DateTime.Now }; _gardenService.assignGardenerToGarden(myallotmentAllocation); 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 void removeGardenerFromGarden(AllotmentAllocation allotmentAllocation) { _gardenDAO.removeGardenerFromGarden(allotmentAllocation); }
public void assignGardenerToGarden(AllotmentAllocation allotmentAllocation) { _gardenDAO.assignGardenerToGarden(allotmentAllocation); }