public ActionResult Delete(Student std) { if (std == null) { return(RedirectToAction("Index")); } // Update database. int i = StudentDao.DeleteRecord(std.StudentId); if (i > 0) { return(RedirectToAction("Index")); } else { ModelState.AddModelError(string.Empty, "Fail to delete it in database."); return(View(std)); } }