Пример #1
0
        public void removeGardenerFromGarden(AllotmentAllocation allotmentAllocation)
        {
            AllotmentAllocation myAlloction = GetAllocatedAllotment(allotmentAllocation.gardenId);

            myAlloction.dateTo = allotmentAllocation.dateTo;

            _context.SaveChanges();
        }
Пример #2
0
        //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();
        }
Пример #3
0
        public void AllocateGarden()
        {
            int gardenId = GetLastGardenId();

            AllotmentAllocation myallotmentAllocation = new AllotmentAllocation
            {
                gardenId = gardenId
            };

            _context.AllotmentAllocation.Add(myallotmentAllocation);
            _context.SaveChanges();
        }
Пример #4
0
        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());
            }
        }
Пример #5
0
        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());
            }
        }
Пример #6
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" }));
        }
Пример #7
0
 public void removeGardenerFromGarden(AllotmentAllocation allotmentAllocation)
 {
     _gardenDAO.removeGardenerFromGarden(allotmentAllocation);
 }
Пример #8
0
 public void assignGardenerToGarden(AllotmentAllocation allotmentAllocation)
 {
     _gardenDAO.assignGardenerToGarden(allotmentAllocation);
 }