Beispiel #1
0
        public override Task <ResponseMessage> RemoveUser(RemoveUserInput request, ServerCallContext context)
        {
            var user = new User()
            {
                Email = request.Email,
            };

            if (_userRepository.ContainsUser(user))
            {
                _userRepository.DeleteUser(user);

                return(Task.FromResult(new ResponseMessage
                {
                    Status = "Ok",
                    Message = "Se ha borrado el usuario",
                }));
            }
            else
            {
                return(Task.FromResult(new ResponseMessage
                {
                    Status = "Error",
                    Message = "Usuario no existe",
                }));
            }
        }
        public async Task <ResponseDto> RemoveUserAsync(UserDto user)
        {
            var input = new RemoveUserInput()
            {
                Email = user.Email,
            };

            var response = await _client.RemoveUserAsync(input);

            return(new ResponseDto()
            {
                Message = response.Message,
                Status = response.Status,
            });
        }
Beispiel #3
0
        public async Task <CommandResult> Remove([FromServices] RemoveUserCommand _removeUserCommand, [FromBody] RemoveUserInput removeUserInput)
        {
            var userInput = new UserInput <RemoveUserInput>
            {
                UserId = User.GetUserId(),
                Data   = removeUserInput
            };

            var result = await
                         Business.InvokeAsync <RemoveUserCommand, UserInput <RemoveUserInput>, CommandResult>(_removeUserCommand,
                                                                                                              userInput).ConfigureAwait(false);

            return(result);
        }