public IActionResult SignUp(User user, string password) { var repos = new AccountRepository(_connectionString); repos.AddUser(user, password); return(Redirect("/")); }
public IActionResult CreateAccount(string password, string email, string name) { var repository = new AccountRepository(_connection); repository.AddUser(name, email, password); return(Redirect("/account/login")); }
public IActionResult SignUp(User user) { AccountRepository repos = new AccountRepository(_connectionString); repos.AddUser(user); return(RedirectToAction("LogIn")); }
public void AddUser(string username, string password) { var user = new User { Name = username, Password = HashPassword(password, PasswordType.AspNetIdentity), PasswordType = PasswordType.AspNetIdentity, IsModerator = ModeratorType.NotModerator }; _accountRepository.AddUser(user); }
public ActionResult Register(tblRegister d) { try { if (d.FirstName != null) { bool result = acc.AddUser(d); if (result) { Account ac = new Account(); ac.Register(d); TempData["registered"] = "success"; ViewBag.Success = "Register Successfully.....Please Log In"; return(RedirectToAction("SignIn")); } else { TempData["registered"] = "error"; ViewBag.Error = "Something Went wrong....."; return(View()); } //if (i > 0) //{ // TempData["registered"] = "success"; // ViewBag.Success = "Register Successfully.....Please Log In"; // if (Session["user"] != null) // { // return RedirectToAction("Register"); // } // else // { // return RedirectToAction("SignIn"); // } //} //else //{ // TempData["registered"] = "error"; // ViewBag.Error = "Something Went wrong....."; // return View(); //} } return(View()); } catch (Exception ex) { TempData["registered"] = "duplicate"; ViewBag.Error = "Something Went wrong....."; return(View()); } }
public void TestAddUser() { User user = new User() { UserID = "10002", Password = "******", Username = "******", Email = "qwertyu@qwer", Confirmed = "User" }; repo.AddUser(user); User testuser = repo.GetUser("10002"); Assert.Equal("10002", testuser.UserID); }
public ActionResult SignUp_Post() { Account user = new Account(); TryUpdateModel(user); if (ModelState.IsValid) { accountRepository.AddUser(user); TempData["Message"] = "User added successfully!!!"; return(RedirectToAction("Login")); } return(View()); }
public async Task <IActionResult> CreateNewUser(CreateNewUserVM model) { if (!ModelState.IsValid) { return(View(model)); } else { await accountrepository.AddUser(model); return(RedirectToAction(nameof(AssignmentsController.CourseFrontPage), "Assignments")); } }
public async Task <IActionResult> Register(RegisterViewModel register) { //var recaptcha = await _recaptcha.Validate(Request); //if (!recaptcha.success) //{ // ModelState.AddModelError("Recaptcha", "There was an error validating recatpcha. Please try again!"); // return View(!ModelState.IsValid ? register : new RegisterViewModel()); //} if (ModelState.IsValid) { if (register.ParticipantType == "Participant" || register.ParticipantType == "Supporter" || register.ParticipantType == "Expert") { VerifyPhoneViewModel verifyPhoneNumber = new VerifyPhoneViewModel(); var result = _repository.AddUser(register); if (result == "added" || result == "confirm") { verifyPhoneNumber.Phone = register.PhoneNumber; return(View("VerifyPhone", verifyPhoneNumber)); } else if (result == "password") { SetPasswordViewModel setPassword = new SetPasswordViewModel(); setPassword.Phone = register.PhoneNumber; return(View("SetPassword", setPassword)); } else { ViewData["Message"] = "این شماره ثبت شده است."; } return(View()); } else { ViewData["Message"] = "خطایی رخ داده مجدد سعی نمایید"; return(View()); } } return(View()); }
public void AddUser(AccountUser dto) { AccountUser user = repository.GetUser(dto.Account); if (user != null) { throw new LogicException("帐号已经存在,不能添加"); } user = new AccountUser() { ID = Bounded.Generator.New(), Account = dto.Account, Name = dto.Name, Pwd = BingoX.Security.SecurityExtension.MD5.Encrypt(dto.Pwd), State = CommonState.Enabled, CreateDate = Bounded.DateTimeService.GetNow(), }; repository.AddUser(user); repository.Commit(); resourceService.ChangedUser(); }
public void AddUser(LoginVM vm) { var repo = new AccountRepository(_connection); repo.AddUser(vm, vm.Password); }
public void AddUser(Account user) { userRepository.AddUser(user); //Adding user details }
public void SignUp(SignupViewModel signupViewModel) { var repos = new AccountRepository(_connectionString); repos.AddUser(signupViewModel, signupViewModel.Password); }
public void AddUser(Account account) //Add user { account.Role = "User"; accountRepository.AddUser(account); }
public async Task <int> AddUser(User user) { return(await _repository.AddUser(user)); }