public ActionResult Create(StudentModel studentmodel) { if (ModelState.IsValid) { db.Students.Add(studentmodel); db.SaveChanges(); return RedirectToAction("Index"); } return View(studentmodel); }
public ActionResult Edit(StudentModel studentmodel) { if (ModelState.IsValid) { db.Entry(studentmodel).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(studentmodel); }