예제 #1
0
        public ActionResult Create(FillTheGapCreateViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                viewModel.FillTheGap.Descripcion = viewModel.FillTheGap.Enunciado.Replace("#", "______");

                db.FillTheGaps.Add(viewModel.FillTheGap);
                db.SaveChanges();
                return(RedirectToAction("Create", "FillTheGaps", new { id = viewModel.FillTheGap.BloqueId }));
            }


            viewModel.Inicializar(viewModel.FillTheGap.BloqueId);
            return(View(viewModel));
        }
예제 #2
0
        // GET: Admin/FillTheGaps/Create
        public ActionResult Create(int id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Bloque bloque = db.Bloques.SingleOrDefault(bl => bl.BloqueId == id);

            if (bloque == null)
            {
                return(HttpNotFound());
            }

            FillTheGapCreateViewModel viewModel = new FillTheGapCreateViewModel();

            viewModel.Inicializar(id);

            viewModel.FillTheGap = new FillTheGap();
            viewModel.FillTheGap.TipoEjercicioId = (int)TiposDeEjerciciosId.FillTheGap;
            viewModel.FillTheGap.BloqueId        = id;
            viewModel.FillTheGap.SubTemaId       = bloque.SubTemaId;
            viewModel.FillTheGap.AreaId          = viewModel.bloque.AreaId;
            return(View(viewModel));
        }