Exemplo n.º 1
0
        public IHttpActionResult ChangeContactInfo(ChangeContactInfoRequest request)
        {
            var player = _queries.GetPlayer(request.PlayerId);

            if (player == null)
            {
                throw new RegoValidationException(ErrorMessagesEnum.PlayerWithRequestedIdDoesntExist.ToString());
            }

            var playerData = Mapper.Map <EditPlayerData>(player);
            var newData    = Mapper.Map <EditPlayerData>(request);

            playerData.PlayerId                 = request.PlayerId;
            playerData.PhoneNumber              = newData.PhoneNumber;
            playerData.MailingAddressLine1      = newData.MailingAddressLine1;
            playerData.MailingAddressLine2      = newData.MailingAddressLine2;
            playerData.MailingAddressLine3      = newData.MailingAddressLine3;
            playerData.MailingAddressLine4      = newData.MailingAddressLine4;
            playerData.MailingAddressCity       = newData.MailingAddressCity;
            playerData.MailingAddressPostalCode = newData.MailingAddressPostalCode;
            playerData.CountryCode              = newData.CountryCode;
            playerData.ContactPreference        = newData.ContactPreference;
            _commands.Edit(playerData);

            var uri = UriRootToProfileInfo + playerData.PlayerId;

            return(Created(uri, new ChangeContactInfoResponse()
            {
                UriToProfileWithUpdatedContactInfo = uri
            }));
        }
Exemplo n.º 2
0
        public async Task <ChangeContactInfoResponse> ChangeContactInfoAsync(ChangeContactInfoRequest request)
        {
            var result = await HttpClient.SecurePostAsJsonAsync(Token, "api/Player/ChangeContactInfo", request);

            return(await EnsureApiResult <ChangeContactInfoResponse>(result));
        }