Пример #1
0
		public virtual ActionResult Index(long id, StateSettingsModel model)
		{
			if(!ModelState.IsValid)
			{
				throw new InvalidOperationException("Failed to save state settings. State id: " + id);
			}

			_settings.SetStateAvailabilities(id, model.Availabilities.GetSettings());
			_settings.SetStateVisibilities(id, model.Visibilities.GetSettings());

			return RedirectToAction(MVC.Admin.StateSettings.Index(id));
		}
Пример #2
0
		public virtual ViewResult Index(long id)
		{
			var state = _states.Get(_identity.Language, id).First().Value;
			ViewBag.StateName = state.LocalizedName;

			var availabilities = _settings.GetStateAvailabilities().Where(x => x.StateId == id).Select(x => x.Role).ToArray();
			var visibilities = _settings.GetStateVisibilities().Where(x => x.StateId == id).Select(x => x.Role).ToArray();

			var model = new StateSettingsModel
			{
				Availabilities = EmailTemplateSettingsModelHelper.GetModel(availabilities),
				Visibilities = EmailTemplateSettingsModelHelper.GetModel(visibilities)
			};

			return View(model);
		}