public ActionResult Register(Member member) { if (_memberRepository.GetByUsername(member.Username) != null) { ModelState.AddModelError("UserName", "Username already exists"); } if(ModelState.IsValid) { _memberRepository.Save(member); return RedirectToAction("Index", "Home"); } TempData["Error"] = "You messed that up."; return View("Register", member); }
public ActionResult Register(RegistrationModel registrationModel) { if (!ModelState.IsValid) return View("Register"); var member = new Member { FirstName = registrationModel.FirstName, LastName = registrationModel.LastName, Username = registrationModel.Username, Password = registrationModel.Password, Email = registrationModel.Email }; _memberRepository.Save(member); _authenticationService.SignIn(member.Username); return RedirectToAction("Profile"); }
public void Save(Member member) { _repository.Save(member); }