示例#1
0
 public ActionResult Edit(QuizStyle quizStyle)
 {
     if (ModelState.IsValid)
     {
         manager.Entry(quizStyle).State = EntityState.Modified;
         manager.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(RedirectToAction("Index"));
 }
示例#2
0
 public ActionResult Create(QuizStyle quizStyle)
 {
     if (ModelState.IsValid)
     {
         manager.QuizStyles.Add(quizStyle);
         manager.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(RedirectToAction("Index"));
 }
示例#3
0
        // GET: QuizStyle/Edit/5
        public ActionResult Edit(int id)
        {
            if (ModelState.IsValid)
            {
                QuizStyle quizStyle = manager.QuizStyles.Find(id);

                ViewBag.QuizStyle = quizStyle;
                return(View());
            }
            return(HttpNotFound());
        }
示例#4
0
        public ActionResult Delete(int id, FormCollection collection)
        {
            try
            {
                QuizStyle quizStyle = manager.QuizStyles.Find(id);

                if (quizStyle != null)
                {
                    manager.QuizStyles.Remove(quizStyle);
                    manager.SaveChanges();
                }
                return(RedirectToAction("Index"));
            }
            catch
            {
                return(RedirectToAction("Index"));
            }
        }