Beispiel #1
0
        public IActionResult EnableDisable(int id)
        {
            var race = _raceRepository.Get(id);

            var model = new EnableDisableRaceViewModel();

            model.IsEnabled = race.IsEnabled;

            return(View(model));
        }
Beispiel #2
0
        public IActionResult EnableDisable(EnableDisableRaceViewModel model)
        {
            if (ModelState.IsValid)
            {
                _raceRepository.EnableDisableRace(model.Id, model.IsEnabled);

                return(RedirectToAction("Index"));
            }

            ModelState.AddModelError("", "Errore generico");

            return(View(model));
        }