public ActionResult SaveStuClub(Student_Club studentClub, string language) { ChangeLanguageFunction(language); if (!ModelState.IsValid) { var clubs = _context.Clubs.ToList(); var viewModels = new StudentClubViewModel() { StudentClub = new Student_Club(Session["Id"].ToString()), Clubs = clubs }; } _context.StudentClubs.Add(studentClub); try { _context.SaveChanges(); } catch (DbUpdateException) { MessageBox.Show(StudentActivity.Resources.Language.Already_a_member_of_the_club, "Existence Error"); } return(RedirectToAction("ShowClubs", "EnglishClub")); }
public ActionResult SaveStuClub(Student_Club studentClub, string language) { ChangingLanguageFunction(language); if (!ModelState.IsValid) { var clubs = _context.Clubs.ToList(); var viewModels = new StudentClubViewModel() { StudentClub = new Student_Club(Session["Id"].ToString()), Clubs = clubs }; } _context.StudentClubs.Add(studentClub); try { _context.SaveChanges(); // Sends StudentClubAddedMessage to the another action using the TempData TempData["StudentClubAddedMessage"] = 1; } catch (DbUpdateException) { //MessageBox.Show(StudentActivity.Resources.Language.Already_a_member_of_the_club, "Existence Error"); // Sends StudentClubRegisteredErrorMessage to the another action using the TempData TempData["StudentClubRegisteredErrorMessage"] = 1; return(RedirectToAction("ShowClubs", "Club")); } return(RedirectToAction("ShowClubs", "Club")); }
// END OF ADMIN ACTIONS // STUDENT ACTIONS public ActionResult AddStuClubs(string language) { ChangeLanguageFunction(language); var clubs = _context.Clubs.ToList(); var studentId = Session["Id"].ToString(); var viewModels = new StudentClubViewModel() { StudentClub = new Student_Club(Session["Id"].ToString()), Clubs = clubs }; return(View("StuClubsForm", viewModels)); }
// END OF ADMIN ACTIONS // STUDENT ACTIONS public ActionResult AddStuClubs(string language) { ChangingLanguageFunction(language); var clubs = _context.Clubs.ToList(); //var studentId = Session["Id"].ToString(); var viewModels = new StudentClubViewModel() { StudentClub = new Student_Club(Session["Id"].ToString()), Clubs = clubs }; if (language.Equals("ar")) { return(View("~/Views/ArabicViews/ArabicClub/StuClubsForm.cshtml", viewModels)); } else { return(View("~/Views/EnglishViews/EnglishClub/StuClubsForm.cshtml", viewModels)); } }