Example #1
0
        public ActionResult Create(TestModel testmodel)
        {
            if (ModelState.IsValid)
            {
                db.Tests.Add(testmodel);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(testmodel);
        }
Example #2
0
 public ActionResult Edit(TestModel testmodel)
 {
     if (ModelState.IsValid)
     {
         db.Entry(testmodel).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(testmodel);
 }