// GET: Language public ActionResult Index() { // this action result is more for redirecting properly // first we need to check if there's a user if (Session["User"] == null) { // if there's no user, we'll need add an alert and also redirect to the login page Session.Add("No User", true); return(RedirectToAction("Login", "User")); } // now we need to check if a language has been selected if (Session["Language"] == null) { // if there's no language, we'll need to add an alert and also redirect to the languages page Session.Add("No Language", true); return(RedirectToAction("Languages", "Language")); } // so at this point, we know there's a user and language selected // we need to make several checks as the word maker doesn't work if we don't have letter types, letters, word patterns or classifications int languageid = Int32.Parse(Session["Language"].ToString()); // check if there are any letter types if (LetterTypeProcessor.getLetterTypesCount(languageid) <= 0) { return(RedirectToAction("LetterTypes", "Language")); } // check if there are any letters if (LetterProcessor.getLettersCount(languageid) <= 0) { return(RedirectToAction("Letters", "Language")); } // check if there are any word patterns if (WordPatternProcessor.getWordPatternsCount(languageid) <= 0) { return(RedirectToAction("WordPatterns", "Language")); } // check if there are any classifications if (ClassificationProcessor.getClassificationsCount(languageid) <= 0) { return(RedirectToAction("Classifications", "Language")); } // otherwise, we'll just go the the words page else { return(RedirectToAction("Words", "Language")); } }