public ActionResult InsertNewDepartment(Department dept) { LTIMVCEntities1 db1 = new LTIMVCEntities1(); dept.DeptId = Convert.ToInt32(Request.Form["txtDeptId"]); dept.DeptName = Request.Form["ddldept1"]; dept.DeptLoc = Request.Form["ddllocation"]; ModelState.AddModelError("", dept.DeptId + " " + dept.DeptName + " " + dept.DeptLoc + " "); db1.Departments.Add(dept); int res1 = db1.SaveChanges(); if (res1 > 0) { ModelState.AddModelError("", "New Department Inserted"); } return(View()); }