public ActionResult Create(StudentModel smodel) { try { if (ModelState.IsValid) { StudentDBHandle dbhandle = new StudentDBHandle(); if (dbhandle.CreateStudent(smodel)) { ViewBag.Message = "Student detail created successfully."; ModelState.Clear(); } } return(RedirectToAction("Index")); } catch { return(View()); } }