示例#1
0
        public ActionResult EditGarden(string pcode, GardenViewModel gardenViewModel, Allotment allotment)
        {
            try
            {
                Allotment myAllotment = new Allotment
                {
                    gardenId = gardenViewModel.gardenId,
                    size     = gardenViewModel.size,
                    postCode = gardenViewModel.postCode
                };

                _gardenService.editGarden(myAllotment);

                return(RedirectToAction("Gardens", new { controller = "Garden" }));
            }
            catch (Exception ex)
            {
                //Might be worth looking at redirection to an error page
                ViewBag.Exception = ex;
                return(View());
            }
        }
示例#2
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());
            }
        }