public IHttpActionResult SignUp(AccountSignUpDto account) { try { var isSignUp = _accountService.SignUp(account); return(Ok(isSignUp)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public async Task <ActionResult> SignUp(AccountSignUpDto model) { if (!ModelState.IsValid) { return(View()); } var account = await _mediator.Send(new SignUp.Command() { Account = model }); return(RedirectToAction(nameof(Login))); }
public bool SignUp(AccountSignUpDto accountDto) { var account = Mapper.Map <AccountSignUpDto, Account>(accountDto); if (_accountRepository.IsAccountExist(account)) { throw new Exception("This e-mail is already exist"); } account.Password = GetPasswordHash(account.Password); account.Birthday = null; _accountRepository.Create(account); return(true); }