public IActionResult Create(CursadaCreateViewModel cursadaCreateViewModel)
        {
            var cursada = cursadaCreateViewModel.Cursada;

            _cursadaService.Add(cursada);

            return(RedirectToAction("Index"));
        }
示例#2
0
        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));
            }
        }