Example #1
0
        public async Task <IActionResult> EditAsync(EditWasteCollectionViewModel model)
        {
            var waterAvailability = await _waterAvailabilityRepository.GetWaterAvailabilityAsync(model.Id);

            if (waterAvailability == null)
            {
                ViewBag.ErrorMessage = $"Water availability information with Id {model.Id} cannot be found";
                return(View("NotFound"));
            }
            else
            {
                waterAvailability.ServiceArea  = model.ServiceArea;
                waterAvailability.Mon          = model.Mon;
                waterAvailability.Tue          = model.Tue;
                waterAvailability.Wed          = model.Wed;
                waterAvailability.Thur         = model.Thur;
                waterAvailability.Fri          = model.Fri;
                waterAvailability.Sat          = model.Sat;
                waterAvailability.Sun          = model.Sun;
                waterAvailability.DateModified = DateTime.Now;

                await _waterAvailabilityRepository.UpdateWaterAvailability(waterAvailability);

                return(RedirectToAction("Complete", new { message = "The water availabilty information was updated successfully" }));
            }
        }
Example #2
0
        public async Task <IActionResult> EditAsync(int id)
        {
            var waterAvailability = await _waterAvailabilityRepository.GetWaterAvailabilityAsync(id);

            if (waterAvailability == null)
            {
                ViewBag.ErrorMessage = $"Water availabilty information with Id {id} cannot be found";
                return(View("NotFound"));
            }

            var model = new EditWasteCollectionViewModel
            {
                Id          = waterAvailability.WaterAvailabilityId,
                ServiceArea = waterAvailability.ServiceArea,
                Mon         = waterAvailability.Mon,
                Tue         = waterAvailability.Tue,
                Wed         = waterAvailability.Wed,
                Thur        = waterAvailability.Thur,
                Fri         = waterAvailability.Fri,
                Sat         = waterAvailability.Sat,
                Sun         = waterAvailability.Sun,
            };

            return(View(model));
        }
Example #3
0
        public async Task <IActionResult> EditAsync(int id)
        {
            var wasteCollection = await _wasteCollectionsRepository.GetWasteCollectionAsync(id);

            if (wasteCollection == null)
            {
                ViewBag.ErrorMessage = $"Waste collection information with={id} cannot be found";
                return(View("NotFound"));
            }

            var model = new EditWasteCollectionViewModel
            {
                Id          = wasteCollection.WasteCollectionId,
                ServiceArea = wasteCollection.ServiceArea,
                Mon         = wasteCollection.Mon,
                Tue         = wasteCollection.Tue,
                Wed         = wasteCollection.Wed,
                Thur        = wasteCollection.Thur,
                Fri         = wasteCollection.Fri,
                Sat         = wasteCollection.Sat,
                Sun         = wasteCollection.Sun,
            };

            return(View(model));
        }