public ActionResult Register(Models.RegistrationViewModel Reg) { if (ModelState.IsValid) { if (MemberDB.IsUserNameTaken(Reg)) { ModelState.AddModelError("UserNameTaken", "Username already exists"); return(View(Reg)); } Member m = new Member() { Username = Reg.Username, EmailAddress = Reg.Email, Password = Reg.Password }; MemberDB.AddNewMember(m); SessionHelper.LogUserIn(m.Username); return(RedirectToAction("Index", "Home")); } return(View(Reg)); }