コード例 #1
0
        public ActionResult Create([Bind(Include = "idmatricula,nombre,nrc,creditos,idarea")] matricula matricula)
        {
            if (ModelState.IsValid)
            {
                MatriculaBLL.Create(matricula);
                return(RedirectToAction("Index"));
            }

            ViewBag.idarea = new SelectList(AreaBLL.List(), "idarea", "nombre", matricula.idalumno);
            return(View(matricula));
        }
コード例 #2
0
 public IHttpActionResult Post(matricula matricula)
 {
     try
     {
         MatriculaBLL.Create(matricula);
         return(Content(HttpStatusCode.Created, "Alumno creado correctamente"));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }
コード例 #3
0
        public ActionResult Create([Bind(Include = "idmatricula,tipo,idalumno,idmateria")] Matricula matricula)
        {
            if (ModelState.IsValid)
            {
                MatriculaBLL.Create(matricula);
                return(RedirectToAction("Index"));
            }

            ViewBag.idalumno  = new SelectList(AlumnoBLL.ListToNames(), "idalumno", "nombre", matricula.idalumno);
            ViewBag.idmateria = new SelectList(MateriaBLL.ListToNames(), "idmateria", "nombre", matricula.idmateria);
            return(View(matricula));
        }
コード例 #4
0
 public ActionResult Create([Bind(Include = "idmatricula,fecha,costo,estado,tipo,idalumno,idmateria")] Matricula matricula)
 {
     if (ModelState.IsValid)
     {
         matricula = MatriculaBLL.TransforEnumCreate(matricula);
         MatriculaBLL.Create(matricula);
         return(RedirectToAction("Index"));
     }
     MatriculaBLL.TransforEnum(matricula);
     ViewBag.tipo      = new SelectList(MatriculaBLL.ListEnum("tipo"), matricula.tipo);
     ViewBag.estado    = new SelectList(MatriculaBLL.ListEnum("estado"), matricula.estado);
     ViewBag.idalumno  = new SelectList(AlumnoBLL.List(), "idalumno", "nombres", matricula.idalumno);
     ViewBag.idmateria = new SelectList(MateriaBLL.List(), "idmateria", "nombre", matricula.idmateria);
     return(View(matricula));
 }