/// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            UpdateUserProfileResponse response = new UpdateUserProfileResponse();


            return(response);
        }
Пример #2
0
        public IActionResult UpdateUserProfile(int id, [FromBody] UserProfile profile)
        {
            profile.UserId = id;

            UpdateUserProfileResponse response = _userService.UpdateUserProfile(profile);

            if (!response.ResponseStatus.HasError())
            {
                return(Ok());
            }

            return(StatusCode(response.ResponseStatus.Status, response.ResponseStatus.Message));
        }
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            UpdateUserProfileResponse response = new UpdateUserProfileResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("createdTimestamp", targetDepth))
                {
                    var unmarshaller = DateTimeUnmarshaller.Instance;
                    response.CreatedTimestamp = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("displayName", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.DisplayName = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("emailAddress", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.EmailAddress = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("lastModifiedTimestamp", targetDepth))
                {
                    var unmarshaller = DateTimeUnmarshaller.Instance;
                    response.LastModifiedTimestamp = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("sshPublicKey", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.SshPublicKey = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("userArn", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.UserArn = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
        public UpdateUserProfileResponse EditUserProfile(UpdateUserProfileRequest updateUserProfileRequest)
        {
            UpdateUserProfileResponse updateUserProfileResponse = null;

            if (updateUserProfileRequest.Id == updateUserProfileRequest.UserProfile.Id)
            {
                var userprofile = _messageMapper.MapToUserProfile(updateUserProfileRequest.UserProfile);
                _userprofileRepository.UpdateUserProfile(userprofile);
                var userprofileDto = _messageMapper.MapToUserProfileDto(userprofile);

                updateUserProfileResponse = new UpdateUserProfileResponse
                {
                };
            }
            return(updateUserProfileResponse);
        }
Пример #5
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            UpdateUserProfileResponse response = new UpdateUserProfileResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("UserProfileArn", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.UserProfileArn = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
Пример #6
0
        public UpdateUserProfileResponse UpdateUserProfile(UserProfile profile)
        {
            UpdateUserProfileResponse response = new UpdateUserProfileResponse();

            //TODO: Handle with non existent user id

            try
            {
                _userRepository.UpdateUserProfile(profile);

                response.ResponseStatus.SetOk();
            }
            catch (Exception e)
            {
                _logger.LogError(e.ToString());

                response.ResponseStatus.SetError(ResponseStatusCode.INTERNAL_SERVER_ERROR,
                                                 e.ToString());
            }

            return(response);
        }