public ActionResult UpdateData(Student modelData) { if (ModelState.IsValid) { try { SqlUtilityClass.Update(modelData); ViewBag.UpdateMessage = "Data updated scuccessfully !!"; } catch (Exception) { new Exception("Data could not be saved, please try again !!"); } ModelState.Clear(); } else { Console.WriteLine("Invalid entry of data, please try again !!"); } return(View()); }
public ActionResult Details(Student modelData) { if (ModelState.IsValid) { try { SqlUtilityClass.StudentDetails(modelData); ViewBag.UpdateMessage = "Data deleted scuccessfully !!"; } catch (Exception) { new Exception("Data could not be deleted, please try again !!"); } ModelState.Clear(); } else { Console.WriteLine("Something went wrong, please try again !!"); } return(View(modelData)); }
public ActionResult Index(Student modelData) { if (ModelState.IsValid) { try { SqlUtilityClass.Insertion(modelData); ViewBag.SuccessMessage = "Data saved scuccessfully !!"; } catch (Exception) { new Exception("Data could not be saved, please try again !!"); } } else { return(View()); } ModelState.Clear(); return(View()); }