public ActionResult AddStudent(Student data) { LearnerEntities ORM = new LearnerEntities(); List <Student> temp = new List <Student>(); temp = ORM.Students.Where(x => x.StudentID == data.StudentID).ToList(); if (!ModelState.IsValid || temp.Count > 0) { ViewBag.VerifyAdd = "That Entry Exists Aleady."; return(View("About")); } ORM.Students.Add(data); ORM.SaveChanges(); ViewBag.VerifyAdd = data.FirstName; return(View("About")); }
public ActionResult AddCour(Course data) { LearnerEntities ORM = new LearnerEntities(); List <Course> temp = new List <Course>(); temp = ORM.Courses.Where(x => x.CourName == data.CourName).ToList(); if (!ModelState.IsValid || temp.Count > 0) { ViewBag.VerifyAdd = "That Entry Exists Aleady."; return(View("About")); } ORM.Courses.Add(data); ORM.SaveChanges(); ViewBag.VerifyAdd = data.CourName; return(View("About")); }