Esempio n. 1
0
        public ActionResult Settings()
        {
            var viewmodel = new StoreSettingsViewModel(baseviewmodel)
            {
                general = new GeneralSettings()
                {
                    orgid         = MASTERdomain.organisation.id,
                    store_enabled =
                        subdomainFlags.HasFlag(SubdomainFlags.STORE_ENABLED),
                    motd           = MASTERdomain.organisation.motd,
                    storeName      = MASTERdomain.storeName,
                    facebookCoupon =
                        MASTERdomain.facebookCoupon.HasValue
                                                              ? MASTERdomain.coupon.code
                                                              : ""
                },
                policies = new PolicySettings()
                {
                    paymentTerms = MASTERdomain.paymentTerms,
                    refundPolicy = MASTERdomain.returnPolicy
                }
            };

            return(View(viewmodel));
        }
        public ActionResult EditStore()
        {
            var company   = Service.GetCompany();
            var viewModel = StoreSettingsViewModel
                            .CreateFrom(company.Store, company.AppleAppStoreCredentials, company.GooglePlayCredentials);

            return(View(viewModel));
        }
Esempio n. 3
0
        public void EditStore_Post_saves_settings_into_company()
        {
            // Arrange

            var model = new StoreSettingsViewModel
            {
                Keywords = "app taxi cab",
                UniqueDeviceIdentificationNumber = new List <string> {
                    "1234567890abcdef"
                },
                AppStoreCredentials = new AppleStoreCredentials
                {
                    Username = "******",
                    Password = "******",
                    Team     = "team"
                },
                GooglePlayCredentials = new AndroidStoreCredentials
                {
                    Username = "******",
                    Password = "******"
                }
            };

            // Act
            Sut.EditStore(model);

            // Assert
            ServiceMock.Verify(x => x.UpdateStoreSettings(It.Is <StoreSettings>(s => s
                                                                                .Keywords == "app taxi cab"
                                                                                &&
                                                                                s.UniqueDeviceIdentificationNumber[0
                                                                                ] == "1234567890abcdef")));

            ServiceMock.Verify(x => x.UpdateAppleAppStoreCredentials(It.Is <AppleStoreCredentials>(s =>
                                                                                                   s.Username ==
                                                                                                   "user@appstore"
                                                                                                   &&
                                                                                                   s.Password ==
                                                                                                   "password"
                                                                                                   &&
                                                                                                   s.Team ==
                                                                                                   "team")));

            ServiceMock.Verify(x => x.UpdateGooglePlayCredentials(It.Is <AndroidStoreCredentials>(s =>
                                                                                                  s.Username ==
                                                                                                  "user@googleplay"
                                                                                                  &&
                                                                                                  s.Password ==
                                                                                                  "password")));
        }
 public ActionResult EditStore(StoreSettingsViewModel model)
 {
     if (ModelState.IsValid)
     {
         try
         {
             Service.UpdateStoreSettings(Mapper.Map <StoreSettings>(model));
             Service.UpdateAppleAppStoreCredentials(model.AppStoreCredentials);
             Service.UpdateGooglePlayCredentials(model.GooglePlayCredentials);
             return(RedirectToAction("Index"));
         }
         catch
         {
             return(View(model));
         }
     }
     return(View(model));
 }