//public TakerBLL(ITakerRepository takerRepository) //{ // _takerRepository = takerRepository; //} public void CreateTaker(TakerRegistrationViewModel registrationViewModel) { var taker = new Taker { TakerName = registrationViewModel.TakerName }; var createdTaker = _takerRepository.Create(taker); _userRepository.CreateUser(registrationViewModel.TakerUserName, registrationViewModel.TakerPassword, UserType.Taker, createdTaker.TakerId); }
public ActionResult RegisterTaker(TakerRegistrationViewModel registrationViewModel) { if (ModelState.IsValid) { if (_loginManager.GetUserByUserName(registrationViewModel.TakerUserName) != null) { ModelState.AddModelError("TakerUserName", "UserName already present."); return(View()); } if (registrationViewModel.TakerPassword.Equals(registrationViewModel.TakerConfirmPassword)) { _takerBLL.CreateTaker(registrationViewModel); return(RedirectToAction("Login")); } else { ModelState.AddModelError("", "Please fill in all the fields of the registration form"); } } return(View()); }