コード例 #1
0
        //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);
        }
コード例 #2
0
ファイル: LoginController.cs プロジェクト: Jhilmil92/REQ
        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());
        }