public ActionResult AddCountry(LocationsCountriesAddViewModel model) { if (!Services.Authorizer.Authorize(Permissions.OShopPermissions.ManageShopSettings, T("Not allowed to manage Countries"))) { return(new HttpUnauthorizedResult()); } if (ModelState.IsValid) { var record = new LocationsCountryRecord() { Name = model.Name, IsoCode = model.IsoCode, AddressFormat = model.AddressFormat, Enabled = model.Enabled, }; if (_shippingService != null) { record.ShippingZoneRecord = _shippingService.GetZone(model.ShippingZoneId); } _locationService.AddCountry(record); Services.Notifier.Information(T("Country {0} successfully added.", model.Name)); return(RedirectToAction("Index")); } model.ShippingZones = _shippingService != null?_shippingService.GetZones() : new List <ShippingZoneRecord>(); return(View(model)); }
public ActionResult AddCountry() { if (!Services.Authorizer.Authorize(Permissions.OShopPermissions.ManageShopSettings, T("Not allowed to manage Countries"))) { return(new HttpUnauthorizedResult()); } var model = new LocationsCountriesAddViewModel(); model.ShippingZones = _shippingService != null?_shippingService.GetZones() : new List <ShippingZoneRecord>(); return(View(model)); }