public IActionResult Create(CursadaCreateViewModel cursadaCreateViewModel) { var cursada = cursadaCreateViewModel.Cursada; _cursadaService.Add(cursada); return(RedirectToAction("Index")); }
public IActionResult Create(CursadaCreateViewModel cursadaCreateViewModel) { var cursada = cursadaCreateViewModel.Cursada; var result = _cursadaService.Add(cursada); if (result == 1) { return(RedirectToAction("Index")); } else if (result == 0) { ModelState.AddModelError("Cursada.Aula", "Capacidad del aula excedida"); return(View(cursadaCreateViewModel)); } else { ModelState.AddModelError("Cursada.Aula", "Capacidad del aula excedida"); return(View(cursadaCreateViewModel)); } }