public RedirectToActionResult GenerateReply(string replyMessageContent, string poster, string chatGenre, string parentMessageID) { //CALLED WHEN the user submits a completed reply form from the ReplyForm view //REDIRECTS TO the main forum page, which will load the new reply //check if replier's username exists //add to userlist if not //generate reply //add reply to message in forum (via MessageBoard) //add reply to poster's history (via userlist) //add reply to the reply list of the original MESSAGE (via userlist) User newUser; Reply reply; List <User> listOfUsers = userRepo.ListOfUsers.ToList(); bool userExists = false; foreach (User u in listOfUsers) { //checking database to user if the username already exists if (u.Username == poster) { userExists = true; //this means that the user has been found in the "database" } } if (userExists != true) { //create new user //add user to Userlist newUser = new User() { Username = poster }; userRepo.AddNewUser(newUser); } //building old message object to grab important info such as usernames (easier than passing around a bunch of view form data) int OGMessageID = int.Parse(parentMessageID); Message message = messageRepo.getMessageFromBoard(chatGenre, OGMessageID); string OGCommenter = message.UserNameSignature; //instantiating reply object reply = new Reply() { UserNameSignature = poster, ReplyContent = replyMessageContent }; messageRepo.findAndAddToMessageReplies(chatGenre, OGMessageID, reply); userRepo.ModifyUserReplyHistory(poster, "add", reply); //UserList.AddReplyToMessage(OGCommenter, OGMessageID, reply); //determine which chatRoom will be displayed in the form when called //determines what the title text will be //determines the which message list gets sorted if (chatGenre == "general") { TempData["chatRoom"] = "general"; TempData["pageTitleText"] = "General Messageboard"; } else if (chatGenre == "starwars") { TempData["chatRoom"] = "starwars"; TempData["pageTitleText"] = "Star Wars Messageboard"; } else { throw new ArgumentException("please enter a valid chatRoomGenre"); } return(RedirectToAction("Forum")); }