示例#1
0
 public ActionResult Edit(MatchTheWordEditViewModel viewModel)
 {
     if (ModelState.IsValid)
     {
         viewModel.MatchTheWord.Descripcion     = viewModel.MatchTheWord.Pregunta + " / " + viewModel.MatchTheWord.Respuesta;
         db.Entry(viewModel.MatchTheWord).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Create", "MatchTheWords", new { id = viewModel.MatchTheWord.BloqueId }));
     }
     viewModel.Inicializar(viewModel.MatchTheWord.SubTemaId);
     return(View(viewModel));
 }
示例#2
0
        // GET: Admin/MatchTheWords/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            MatchTheWord matchTheWord = db.MatchTheWords.Find(id);

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


            MatchTheWordEditViewModel viewModel = new MatchTheWordEditViewModel();

            viewModel.Inicializar(matchTheWord.BloqueId);
            viewModel.MatchTheWord = matchTheWord;
            return(View(viewModel));
        }