public virtual async Task <IHttpActionResult> UpdateAccountAsync(EditAccountRequest request)
        {
            var param = new UpdateAccountParam
            {
                CustomerId        = ComposerContext.CustomerId,
                Scope             = ComposerContext.Scope,
                PreferredLanguage = request.PreferredLanguage,
                Email             = request.Email,
                FirstName         = request.FirstName,
                LastName          = request.LastName,
                CultureInfo       = ComposerContext.CultureInfo,
            };

            var urlParam = new BaseUrlParameter {
                CultureInfo = param.CultureInfo
            };
            var addressListUrl    = MyAccountUrlProvider.GetAddressListUrl(urlParam);
            var changePasswordUrl = MyAccountUrlProvider.GetChangePasswordUrl(urlParam);

            var viewModel = await CustomerViewService.UpdateAccountAsync(param);

            if (viewModel == null)
            {
                return(Unauthorized());
            }

            viewModel.AddressListUrl    = addressListUrl;
            viewModel.ChangePasswordUrl = changePasswordUrl;

            return(Ok(viewModel));
        }
Пример #2
0
        public ActionResult SharedWishListTitle(string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                return(View("SharedWishListHeaderBlade"));
            }

            var param = SharedWishListTokenizer.DecryptToken(id);

            if (param == null)
            {
                return(HttpNotFound());
            }

            var vm = CustomerViewService.GetAccountHeaderViewModelAsync(new GetAccountHeaderViewModelParam
            {
                Scope       = param.Scope,
                CultureInfo = ComposerContext.CultureInfo,
                CustomerId  = param.CustomerId
            }).Result;

            if (vm == null)
            {
                return(HttpNotFound());
            }

            return(View("SharedWishListHeaderContainer", vm));
        }
        public virtual ActionResult AccountHeader()
        {
            var viewModel = CustomerViewService.GetAccountHeaderViewModelAsync(new GetAccountHeaderViewModelParam
            {
                Scope       = ComposerContext.Scope,
                CultureInfo = ComposerContext.CultureInfo,
                CustomerId  = ComposerContext.CustomerId
            }).Result;

            return(View("AccountHeaderBlade", viewModel));
        }
Пример #4
0
        public ActionResult SharedWishList(string id, XhtmlDocument emptyWishListContent)
        {
            if (string.IsNullOrEmpty(id))
            {
                return(HttpNotFound());
            }

            var param = SharedWishListTokenizer.DecryptToken(id);

            if (param == null)
            {
                return(HttpNotFound());
            }

            var customerStatus = CustomerViewService.GetAccountStatusViewModelAsync(new GetAccountStatusViewModelParam
            {
                CultureInfo = ComposerContext.CultureInfo,
                Scope       = param.Scope,
                CustomerId  = param.CustomerId
            }).Result;

            if (customerStatus == null || customerStatus.Status == AccountStatusEnum.Inactive)
            {
                return(HttpNotFound());
            }

            var vm = WishLisViewService.GetWishListViewModelAsync(new GetCartParam
            {
                BaseUrl     = RequestUtils.GetBaseUrl(Request).ToString(),
                CultureInfo = ComposerContext.CultureInfo,
                CartName    = CartConfiguration.WishlistCartName,
                Scope       = param.Scope,
                CustomerId  = param.CustomerId
            }).Result;

            if (vm != null && vm.TotalQuantity == 0 && emptyWishListContent != null)
            {
                return(View("SharedWishListContainer", new { TotalQuantity = 0, EmptyContent = emptyWishListContent.Body }));
            }

            return(View("SharedWishListContainer", vm));
        }
        public virtual ActionResult UpdateAccount()
        {
            var urlParam = new BaseUrlParameter
            {
                CultureInfo = ComposerContext.CultureInfo
            };
            var changePasswordUrl = MyAccountUrlProvider.GetChangePasswordUrl(urlParam);
            var addressListUrl    = MyAccountUrlProvider.GetAddressListUrl(urlParam);

            var param = new GetUpdateAccountViewModelParam
            {
                Scope       = ComposerContext.Scope,
                CultureInfo = ComposerContext.CultureInfo,
                CustomerId  = ComposerContext.CustomerId
            };

            var viewModel = CustomerViewService.GetUpdateAccountViewModelAsync(param).Result;

            viewModel.ChangePasswordUrl = changePasswordUrl;
            viewModel.AddressListUrl    = addressListUrl;

            return(View("UpdateAccountBlade", viewModel));
        }