public ActionResult CreateEvent(Sport_Event sportEventDetails) { if (ModelState.IsValid) { using (var context = new StripeEntities()) { int id = Convert.ToInt32(Session["loginid"]); SchoolClass schoolRecord = new SchoolClass(context); sportEventDetails.School_Home_sch_ID = schoolRecord.getSchoolDetailsFromDirector(id).sch_ID; if (sportEventDetails.School_Away_sch_ID == sportEventDetails.School_Home_sch_ID) { ModelState.AddModelError("", "Cannot select same away and home team"); return View(); } else { sportEventDetails.event_Completion = "N"; context.Sport_Event.Add(sportEventDetails); context.SaveChanges(); return RedirectToAction("Home"); } } } else { return View("Error"); } }
public ActionResult EditEvent(Sport_Event sportDetails) { using (var context = new StripeEntities()) { context.SP_EVENT_DETAILS_UPDATE(sportDetails.event_Date, sportDetails.event_Time, sportDetails.event_School_Field_Name, sportDetails.Sport_Name_spt_Sport_Name_ID, sportDetails.event_ID); context.SaveChanges(); return RedirectToAction("ViewEvents", "Director"); } }