Exemplo n.º 1
0
 public ActionResult Create([Bind(Include = "LastName, FirstMidName, EnrollmentDate")] Student student)
 {
     try
     {
         if (ModelState.IsValid)
         {
             if (studentCRUD.Create(student))
             {
                 return(RedirectToAction("Index"));
             }
         }
     }
     catch (DataException /* dex */)
     {
         //Log the error (uncomment dex variable name and add a line here to write a log.
         ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator.");
     }
     return(View(student));
 }