public ActionResult Index(AccountModel model)
        {
            if (model == null)
                throw new ArgumentNullException();

            if (ModelState.IsValid)
            {
                var vendor = _vendorService.GetVendorById(_workContext.CurrentVendor.Id);
                vendor.Email = model.Email;
                vendor.Name = model.AttentionTo;
                _vendorService.UpdateVendor(vendor);

                // setting generic attributes
                vendor.SetShopName(model.ShopName);
                
                var vendorAddress = _vendorAddressService.GetVendorAddressByVendorId(vendor.Id);
                var address = _addressService.GetAddressById(vendorAddress.AddressId);
                address.Address1 = model.ShippingAddress.Address1;
                address.City = model.ShippingAddress.City;
                address.ZipPostalCode = model.ShippingAddress.ZipPostalCode;
                address.CountryId = model.ShippingAddress.CountryId;
                _addressService.UpdateAddress(address);

                RedirectToAction("Index");
            }

            PrepareAccountModel(model);
            return View(model);
        }
        protected virtual void PrepareAccountModel(AccountModel model)
        {
            //countries and states
            //if (_customerSettings.CountryEnabled)
            {
                model.AvailableCountries.Add(new SelectListItem { Text = _localizationService.GetResource("Address.SelectCountry"), Value = "0" });
                foreach (var c in _countryService.GetAllCountries())
                {
                    model.AvailableCountries.Add(new SelectListItem
                    {
                        Text = c.GetLocalized(x => x.Name),
                        Value = c.Id.ToString(),
                        Selected = c.Id == model.ShippingAddress.CountryId
                    });
                }

                //if (_customerSettings.StateProvinceEnabled)
                {
                    //states
                    if (model.ShippingAddress.CountryId != null)
                    {
                        var states = _stateProvinceService.GetStateProvincesByCountryId((int)model.ShippingAddress.CountryId).ToList();
                        if (states.Count > 0)
                        {
                            model.AvailableStates.Add(new SelectListItem { Text = _localizationService.GetResource("Address.SelectState"), Value = "0" });

                            foreach (var s in states)
                            {
                                model.AvailableStates.Add(new SelectListItem { Text = s.GetLocalized(x => x.Name), Value = s.Id.ToString(), Selected = (s.Id == model.ShippingAddress.StateProvinceId) });
                            }
                        }
                        else
                        {
                            bool anyCountrySelected = model.AvailableCountries.Any(x => x.Selected);

                            model.AvailableStates.Add(new SelectListItem
                            {
                                Text = _localizationService.GetResource(anyCountrySelected ? "Address.OtherNonUS" : "Address.SelectState"),
                                Value = "0"
                            });
                        }
                    }

                }
            }
        }
        public ActionResult Index()
        {
            if (!_workContext.CurrentVendor.HasPaidGroupDeals())
            {
                for (int i = 0; i < 10; i++)
                {
                    _groupDealService.CreateGroupDealProduct(_workContext.CurrentVendor.GetShopName() + " register", 25);
                }
                _workContext.CurrentVendor.SetHasPaidGroupDeals(true);
            }

            var accountModel = new AccountModel();
            accountModel.AttentionTo = _workContext.CurrentVendor.Name;
            accountModel.Email = _workContext.CurrentVendor.Email;
            accountModel.Password = _workContext.CurrentCustomer.Password;
            accountModel.VacationMode = null;
            accountModel.VacationEndsAt = DateTime.Parse("01/01/2017");

            // get generic attributes
            accountModel.ShopName = _workContext.CurrentVendor.GetShopName();
            
            var vendorAddress = _vendorAddressService.GetVendorAddressByVendorId(_workContext.CurrentVendor.Id);
            var address = _addressService.GetAddressById(vendorAddress.AddressId);
            accountModel.ShippingAddress.Address1 = address.Address1;
            accountModel.ShippingAddress.City = address.City;
            accountModel.ShippingAddress.ZipPostalCode = address.ZipPostalCode;
            accountModel.ShippingAddress.CountryId = address.CountryId;

            PrepareAccountModel(accountModel);
            
            return View(accountModel);
        }