public ActionResult Create(Employee employee) { if (ModelState.IsValid) { db.Employees.Add(employee); db.SaveChanges(); return RedirectToAction("Index"); } return View(employee); }
public ActionResult Edit(Employee employee) { if (ModelState.IsValid) { db.Entry(employee).State = EntityState.Modified; // Add some code here to catch the exception of wrong type data saved. db.SaveChanges(); return RedirectToAction("Index"); } return View(employee); }