Exemplo n.º 1
0
		public async Task<BaseResponse> Register(RegisterUserCommand command) {
			var response = new BaseResponse();
			var request = new UserRequest();

			request.Username = command.Email;

			var user = await _userQueryService.GetByUsername(command.Email);

			if (user != null) {
				response.Ack = AckType.FAILURE;
				response.Message = string.Format("There is already a user with the email {0}.", command.Email);

				return response;
			}

			await _commandDispatcher.Dispatch(command);

			return response;
		}
Exemplo n.º 2
0
		public async Task<HttpResponseMessage> Register(RegisterUserCommand command) {
			await _userApplicationService.Register(command);
			return OkResponse(command.Identifier);
		}
Exemplo n.º 3
0
		public async Task<ActionResult> Register(RegisterModel model, string returnUrl) {

			if (!ModelState.IsValid) {
				return View(model);
			}

			var userId = Guid.NewGuid();
			var command = new RegisterUserCommand(userId, model.Name, model.Email, model.Password);

			var response = await _userProxy.Register(command);

			if (response.Ack == AckType.SUCCESS) {
				var appIdentity = new AppIdentity(userId.ToString(), command.Name, command.Email);
				_authenticationService.SignIn(appIdentity, true);

				return RedirectToLocal(returnUrl);
			}

			return View(model);
		}
Exemplo n.º 4
0
		public async Task<BaseResponse> Register(RegisterUserCommand command) {
			return await SendCommand(command, "user/register/");
		}