示例#1
0
        public async Task <UserUpdateResponseMessage> InsertUserDetailsAsync(UserUpdateRequestMessage userDetails)
        {
            UserUpdateResponseMessage responseUser = new UserUpdateResponseMessage();

            try
            {
                UserInformationValidation validator = new UserInformationValidation();
                var result = validator.Validate(userDetails);
                if (result.IsValid)
                {
                    var UserInfo = await insertUserDetails.InsertUserDetails(userDetails);

                    if (UserInfo)
                    {
                        responseUser.Success = UserInfo;
                        return(responseUser);
                    }
                    throw new UpdateUserDetailsExceptions(ErrorCodes.USER_NOT_FOUND);
                }
                throw new UpdateUserDetailsExceptions(ErrorCodes.ERROR_FROM_VALIDATE);
            }
            catch (UpdateUserDetailsExceptions e)
            {
                responseUser.ErrorCode = e._errorConstants.ToString();
                return(responseUser);
            }
        }
        async public Task <UserUpdateResponseMessage> UpdateUserDetailsAsync(UserUpdateRequestMessage userDetails)
        {
            UserUpdateResponseMessage responseUser = new UserUpdateResponseMessage();

            try
            {
                UserInformationValidation validator = new UserInformationValidation();
                var result = validator.Validate(userDetails);
                if (result.IsValid)
                {
                    /*var UserInfo = await ServiceManager.GetInstance().UserDetailsUpdate()
                     *  .BusinessUpdateUserInformation(userDetails);*/
                    var UserInfo = await userUpdateService.BusinessUpdateUserInformation(userDetails);

                    if (UserInfo)
                    {
                        responseUser.Success = UserInfo;
                        return(responseUser);
                    }
                    throw new UpdateUserDetailsExceptions(ErrorCodes.USER_NOT_FOUND);
                }
                throw new UpdateUserDetailsExceptions(ErrorCodes.ERROR_FROM_VALIDATE);
            }
            catch (UpdateUserDetailsExceptions e)
            {
                responseUser.ErrorCode = e._errorConstants.ToString();
                return(responseUser);
            }
        }