private void SaveAccount()
 {
     if (_authenticationService.CreateUser(User.Username, User.Password))
     {
         UserAuthenticated(this, new UserAuthenticatedEventArgs(User.Username));
     }
     else
     {
         UserExists = true;
     }
 }
예제 #2
0
        public ActionResult Register(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = authentication.CreateUser(Mapper.Map <UserContract>(model));
                if (user != null)
                {
                    return(RedirectToAction("GetAll", "Game"));
                }
            }

            return(View(model));
        }
예제 #3
0
        public IActionResult CreateUser(UserInfo objUserInfo)
        {
            string vout = string.Empty;
            ResponseApi <dynamic> response = new ResponseApi <dynamic>();

            #region Check validation if every required field are given
            Validation objValidation = new Validation();
            vout = objValidation.ValidateUserRegistration(objUserInfo);
            #endregion
            if (vout.Contains("OK"))
            {
                DateTime utcDate = DateTime.UtcNow;

                objUserInfo.ActionDate = utcDate;
                objUserInfo.ActionType = "INSERT";

                response = _iAuthentication.CreateUser(objUserInfo);
            }

            return(Ok(response));
        }
 public void CreateAuthenticationDataBase(IAuthentication authenticaton)
 {
     foreach (var user in _dbContext.Users)
         authenticaton.CreateUser(user.Name, user.Password);
 }