Example #1
0
        public ActionResult Create(StudentModel studentmodel)
        {
            if (ModelState.IsValid)
            {
                db.Students.Add(studentmodel);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

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