public IActionResult EnableDisable(int id) { var race = _raceRepository.Get(id); var model = new EnableDisableRaceViewModel(); model.IsEnabled = race.IsEnabled; return(View(model)); }
public IActionResult EnableDisable(EnableDisableRaceViewModel model) { if (ModelState.IsValid) { _raceRepository.EnableDisableRace(model.Id, model.IsEnabled); return(RedirectToAction("Index")); } ModelState.AddModelError("", "Errore generico"); return(View(model)); }