Exemple #1
0
        public async Task <UserProfileResponse> Update(int?id, JsonPatchDocument <UserProfile>?userProfilePatch)
        {
            if (!id.HasValue)
            {
                _logger.Warning(NullInput + nameof(id));
                return(new UserProfileResponse(HttpBadRequest, BadRequestMsg));
            }

            if (IsBadUserProfilePatch(userProfilePatch))
            {
                return(new UserProfileResponse(HttpBadRequest, BadRequestMsg));
            }

            var updateResult = await _profileDataService.Patch(id.Value, userProfilePatch);

            if (updateResult != HttpOk)
            {
                return(new UserProfileResponse(updateResult));
            }

            //round trip get should be in new transaction
            return(await GetUpdatedUserProfile(id));
        }