//
 // GET: /Questions/Create
 public ActionResult Create(int testid = 0)
 {
     ViewBag.idTest = testid;
     Questions question = new Questions();
     question.test_id = testid;
     return View();
 }
        public ActionResult Create(Questions questions)
        {
            string ptt = "";
            ptt = RouteData.Values["testid"] + Request.Url.Query;
            ptt = ptt.Replace("?testid=", ""); //idCourse=1
            questions.test_id = int.Parse(ptt);
            if (ModelState.IsValid)
            {
                db.create(questions);
                db.SaveChanges();
                return RedirectToAction("Index", new { id = questions.test_id });
            }

            return View(questions);
        }
Exemple #3
0
 public Questions edit(Questions questions)
 {
     return new JavaScriptSerializer().Deserialize<Questions>(
     new Enlace().EjecutarAccion(url + "/" + questions.ID.ToString() + data, "PUT", Test));
 }
Exemple #4
0
 public Questions delete(Questions questions)
 {
     return new JavaScriptSerializer().Deserialize<Questions>(
     new Enlace().EjecutarAccion(url + "/" + questions.ID.ToString() + data, "DELETE", questions));
 }
Exemple #5
0
 public Questions create(Questions question)
 {
     return new JavaScriptSerializer().Deserialize<Questions>(
     new Enlace().EjecutarAccion(url + ".json", "POST", question));
 }
 public ActionResult Edit(Questions questions)
 {
     if (ModelState.IsValid)
     {
         db.Entry(questions).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(questions);
 }