public ActionResult Index(int id) { var alumno = _alumnosBL.ObtenerAlumnos(id); var censo = new CensoMaestro(); censo.PeriodoId = 1; censo.AlumnoId = id; censo.Alumno = alumno; var asignaturas = _asignaturasBL.ObtenerAsignaturasActivos(); var horarios = _horarioBL.ObtenerHorarios(); foreach (var asignatura in asignaturas) { censo.ListadeCensoDetalle.Add(new CensoDetalle() { AsignaturaId = asignatura.Id, Asignatura = asignatura }); } ViewBag.HorarioId = new SelectList(horarios, "Id", "Horario"); return(View(censo)); }
public ActionResult Crear(CensoDetalle censoDetalle) { if (ModelState.IsValid) { /* if (censoDetalle.AsignaturaId == 0) * { * * }*/ _censoMaestroBL.GuardarCensoDetalle(censoDetalle); return(RedirectToAction("Index", new { id = censoDetalle.CensoMaestroId })); } var asignaturas = _asignaturasBL.ObtenerAsignaturasActivos(); ViewBag.AsignaturaId = new SelectList(asignaturas, "Id", "NombreAsignatura"); var horarios = _horarioBL.ObtenerHorarios(); ViewBag.HorarioId = new SelectList(horarios, "Id", "Horario"); return(View(censoDetalle)); }