public ActionResult RegisterRequest(RegisterViewModel viewModel) { DataRepository helper = new DataRepository(); if (viewModel.username == null) { viewModel.errorMessage = "Please type in a username"; return RedirectToAction("Register",viewModel); } else if (viewModel.password != viewModel.retypePassword) { viewModel.errorMessage = "Make sure both passwords are the same"; return RedirectToAction("Register",viewModel); } else if (helper.usernameExists(viewModel.username)) { viewModel.errorMessage = "Sorry, that alias has been taken"; return RedirectToAction("Register",viewModel); } else { helper.AddUser(viewModel); helper.FollowSelf(viewModel.username.ToString()); Session["LoggedIn"] = "true"; Session["Username"] = viewModel.username.ToString(); return RedirectToAction("Index", "Home", new { Id = Session["Username"].ToString(), State = "Network" }); } }