Esempio n. 1
0
        public ActionResult Create(SkillwiseCreateViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                viewModel.Skillwise.Descripcion = viewModel.Skillwise.Enunciado;

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


            viewModel.Inicializar(viewModel.Skillwise.BloqueId);
            return(View(viewModel));
        }
Esempio n. 2
0
        // GET: Admin/Skillwises/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());
            }
            SkillwiseCreateViewModel viewModel = new SkillwiseCreateViewModel();

            viewModel.Inicializar(id);

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