コード例 #1
0
 public ActionResult EditAddress(UserProfileAddressViewModel viewModel)
 {
     if (ModelState.IsValid)
     {
         UserProfile profile = CurrentUserProfileOrThrow;
         profile.AddressLine1 = viewModel.AddressLine1;
         profile.AddressLine2 = viewModel.AddressLine2;
         profile.City         = viewModel.City;
         profile.State        = viewModel.State;
         profile.PostalCode   = viewModel.PostalCode;
         profile.CountryCode  = viewModel.CountryCode;
         GStoreDb.UserProfiles.Update(profile);
         GStoreDb.SaveChanges();
         AddUserMessage("Address Updated", "Your address has been updated.", UserMessageType.Info);
         return(RedirectToAction("Index"));
     }
     return(View(viewModel));
 }
コード例 #2
0
        public ActionResult EditAddress()
        {
            UserProfileAddressViewModel viewModel = new UserProfileAddressViewModel(CurrentUserProfileOrThrow);

            return(View(viewModel));
        }