Beispiel #1
0
        public ActionResult Index()
        {
            var           activeSendMethods    = SendMethods.GetActiveMethods();
            var           activePaymentMethods = PaymentMethods.GetActiveMethods();
            ViewBuyerInfo buyer = new ViewBuyerInfo();

            if (User.Identity.IsAuthenticated)
            {
                var user = OSUsers.GetByID(UserID);

                #region Mapp To Buyer

                buyer.Firstname = user.Firstname;
                buyer.Lastname  = user.Lastname;
                buyer.Email     = user.Email;

                // TODO: UserAddresses
                buyer.Phone       = user.Phone;
                buyer.Mobile      = user.Mobile;
                buyer.HomeAddress = user.HomeAddress;
                buyer.PostalCode  = user.PostalCode;
                if (user.StateID.HasValue)
                {
                    buyer.StateName = Cities.GetCityName(user.StateID.Value);
                }
                if (user.CityID.HasValue)
                {
                    buyer.CityName = Cities.GetCityName(user.CityID.Value);
                }

                #endregion Mapp To Buyer
            }

            var send    = Mapper.Map <List <ViewSendMethod> >(activeSendMethods);
            var payment = Mapper.Map <List <ViewPaymentMethod> >(activePaymentMethods);

            CartSettings cart = new CartSettings
            {
                PaymentMethods   = payment,
                SendMethods      = send,
                IsAuthentication = User.Identity.IsAuthenticated,
                BuyerInfo        = buyer
            };

            return(View(cart));
        }