예제 #1
0
 public ActionResult Edit(Answer answer)
 {
     if (ModelState.IsValid)
     {
         db.Entry(answer).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(answer);
 }
예제 #2
0
        public ActionResult Create(Answer answer)
        {
            if (ModelState.IsValid)
            {
                db.Answers.Add(answer);
                db.SaveChanges();
                return RedirectToAction("Index");  
            }

            return View(answer);
        }