Exemplo n.º 1
0
        public void PassivateUser(string email)
        {
            User user = this.userRepository.GetSingleWithEmail(email);

            if (user.Status == StatusType.NotAvailable)
            {
                throw new Exception(ResponseMessages.Get(ServiceResponseCode.RM0000.ToString(), ""));
            }

            user.Passivate();
            this.userRepository.Update(user);
        }
Exemplo n.º 2
0
        private object GetReturnDto(IInvocation invocation, string errorCode, string responseMessage)
        {
            if (invocation.Method.ReturnType == typeof(void))
            {
                return(null);
            }

            var returnValue = Activator.CreateInstance(invocation.Method.ReturnType);

            BaseResponseDTO dto = returnValue as BaseResponseDTO;

            if (dto != null)
            {
                dto.Header.ResponseCode = errorCode;
                dto.Header.Message      = ResponseMessages.Get(errorCode, this.GetLanguageCode(invocation));
            }

            return(returnValue);
        }
Exemplo n.º 3
0
        public DomainUserResponseDTO CreateUser(DomainUserRequestDTO requestDto)
        {
            User user = this.userRepository.GetSingleWithEmail(requestDto.Email);

            if (user != null)
            {
                throw new Exception("User already exists.");
            }

            user = new User(requestDto.Email, requestDto.NewPassword);
            user = this.userRepository.Add(user);

            DomainUserResponseDTO response = new DomainUserResponseDTO()
            {
                ResponseCode = ServiceResponseCode.RM0000.ToString(),
                Status       = 0,
                Message      = ResponseMessages.Get(ServiceResponseCode.RM0000.ToString(), requestDto.LanguageCode),
                User         = user
            };

            return(response);
        }