public IActionResult Create(AddressAttributeModel model, bool continueEditing) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageSettings)) { return(AccessDeniedView()); } if (ModelState.IsValid) { var addressAttribute = model.ToEntity(); addressAttribute.Locales.Clear(); foreach (var local in model.Locales) { if (!(String.IsNullOrEmpty(local.Name))) { addressAttribute.Locales.Add(new Core.Domain.Localization.LocalizedProperty() { LanguageId = local.LanguageId, LocaleKey = "Name", LocaleValue = local.Name }); } } _addressAttributeService.InsertAddressAttribute(addressAttribute); //locales //UpdateAttributeLocales(addressAttribute, model); SuccessNotification(_localizationService.GetResource("Admin.Address.AddressAttributes.Added")); return(continueEditing ? RedirectToAction("Edit", new { id = addressAttribute.Id }) : RedirectToAction("List")); } //If we got this far, something failed, redisplay form return(View(model)); }
public virtual IActionResult Create(AddressAttributeModel model, bool continueEditing) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageSettings)) { return(AccessDeniedView()); } if (ModelState.IsValid) { var addressAttribute = model.ToEntity(); _addressAttributeService.InsertAddressAttribute(addressAttribute); //activity log _customerActivityService.InsertActivity("AddNewAddressAttribute", string.Format(_localizationService.GetResource("ActivityLog.AddNewAddressAttribute"), addressAttribute.Id), addressAttribute); //locales UpdateAttributeLocales(addressAttribute, model); SuccessNotification(_localizationService.GetResource("Admin.Address.AddressAttributes.Added")); if (continueEditing) { //selected tab SaveSelectedTabName(); return(RedirectToAction("Edit", new { id = addressAttribute.Id })); } return(RedirectToAction("List")); } //If we got this far, something failed, redisplay form return(View(model)); }
public ActionResult Create(AddressAttributeModel model, bool continueEditing) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageSettings)) return AccessDeniedView(); if (ModelState.IsValid) { var addressAttribute = model.ToEntity(); addressAttribute.Locales.Clear(); foreach(var local in model.Locales) { if(!(String.IsNullOrEmpty(local.Name))) addressAttribute.Locales.Add(new Core.Domain.Localization.LocalizedProperty() { LanguageId = local.LanguageId, LocaleKey = "Name", LocaleValue = local.Name }); } _addressAttributeService.InsertAddressAttribute(addressAttribute); //locales //UpdateAttributeLocales(addressAttribute, model); SuccessNotification(_localizationService.GetResource("Admin.Address.AddressAttributes.Added")); return continueEditing ? RedirectToAction("Edit", new { id = addressAttribute.Id }) : RedirectToAction("List"); } //If we got this far, something failed, redisplay form return View(model); }
public virtual async Task <AddressAttribute> UpdateAddressAttributeModel(AddressAttributeModel model, AddressAttribute addressAttribute) { addressAttribute = model.ToEntity(addressAttribute); await _addressAttributeService.UpdateAddressAttribute(addressAttribute); return(addressAttribute); }
public virtual async Task <AddressAttribute> InsertAddressAttributeModel(AddressAttributeModel model) { var addressAttribute = model.ToEntity(); await _addressAttributeService.InsertAddressAttribute(addressAttribute); return(addressAttribute); }
public virtual AddressAttribute InsertAddressAttributeModel(AddressAttributeModel model) { var addressAttribute = model.ToEntity(); _addressAttributeService.InsertAddressAttribute(addressAttribute); return(addressAttribute); }
public ActionResult Edit(AddressAttributeModel model, bool continueEditing) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageSettings)) { return(AccessDeniedView()); } var addressAttribute = _addressAttributeService.GetAddressAttributeById(model.Id); if (addressAttribute == null) { //No address attribute found with the specified id return(RedirectToAction("List")); } if (ModelState.IsValid) { addressAttribute = model.ToEntity(addressAttribute); addressAttribute.Locales.Clear(); foreach (var local in model.Locales) { if (!(String.IsNullOrEmpty(local.Name))) { addressAttribute.Locales.Add(new Core.Domain.Localization.LocalizedProperty() { LanguageId = local.LanguageId, LocaleKey = "Name", LocaleValue = local.Name }); } } _addressAttributeService.UpdateAddressAttribute(addressAttribute); //locales //UpdateAttributeLocales(addressAttribute, model); SuccessNotification(_localizationService.GetResource("Admin.Address.AddressAttributes.Updated")); if (continueEditing) { //selected tab SaveSelectedTabIndex(); return(RedirectToAction("Edit", new { id = addressAttribute.Id })); } return(RedirectToAction("List")); } //If we got this far, something failed, redisplay form return(View(model)); }
public virtual IActionResult Edit(AddressAttributeModel model, bool continueEditing) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageSettings)) { return(AccessDeniedView()); } //try to get an address attribute with the specified id var addressAttribute = _addressAttributeService.GetAddressAttributeById(model.Id); if (addressAttribute == null) { return(RedirectToAction("List")); } if (ModelState.IsValid) { addressAttribute = model.ToEntity(addressAttribute); _addressAttributeService.UpdateAddressAttribute(addressAttribute); //activity log _customerActivityService.InsertActivity("EditAddressAttribute", string.Format(_localizationService.GetResource("ActivityLog.EditAddressAttribute"), addressAttribute.Id), addressAttribute); //locales UpdateAttributeLocales(addressAttribute, model); SuccessNotification(_localizationService.GetResource("Admin.Address.AddressAttributes.Updated")); if (!continueEditing) { return(RedirectToAction("List")); } //selected tab SaveSelectedTabName(); return(RedirectToAction("Edit", new { id = addressAttribute.Id })); } //prepare model model = _addressAttributeModelFactory.PrepareAddressAttributeModel(model, addressAttribute, true); //if we got this far, something failed, redisplay form return(View(model)); }
public virtual async Task <IActionResult> Edit(AddressAttributeModel model, bool continueEditing) { if (!await _permissionService.AuthorizeAsync(StandardPermissionProvider.ManageSettings)) { return(AccessDeniedView()); } //try to get an address attribute with the specified id var addressAttribute = await _addressAttributeService.GetAddressAttributeByIdAsync(model.Id); if (addressAttribute == null) { return(RedirectToAction("List")); } if (ModelState.IsValid) { addressAttribute = model.ToEntity(addressAttribute); await _addressAttributeService.UpdateAddressAttributeAsync(addressAttribute); //activity log await _customerActivityService.InsertActivityAsync("EditAddressAttribute", string.Format(await _localizationService.GetResourceAsync("ActivityLog.EditAddressAttribute"), addressAttribute.Id), addressAttribute); //locales await UpdateAttributeLocalesAsync(addressAttribute, model); _notificationService.SuccessNotification(await _localizationService.GetResourceAsync("Admin.Address.AddressAttributes.Updated")); if (!continueEditing) { return(RedirectToAction("List")); } return(RedirectToAction("Edit", new { id = addressAttribute.Id })); } //prepare model model = await _addressAttributeModelFactory.PrepareAddressAttributeModelAsync(model, addressAttribute, true); //if we got this far, something failed, redisplay form return(View(model)); }
public ActionResult Create(AddressAttributeModel model, bool continueEditing) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageSettings)) return AccessDeniedView(); if (ModelState.IsValid) { var addressAttribute = model.ToEntity(); _addressAttributeService.InsertAddressAttribute(addressAttribute); //locales UpdateAttributeLocales(addressAttribute, model); SuccessNotification(_localizationService.GetResource("Admin.Address.AddressAttributes.Added")); return continueEditing ? RedirectToAction("Edit", new { id = addressAttribute.Id }) : RedirectToAction("List"); } //If we got this far, something failed, redisplay form return View(model); }
public ActionResult Create(AddressAttributeModel model, bool continueEditing) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageSettings)) { return(AccessDeniedView()); } if (ModelState.IsValid) { var addressAttribute = model.ToEntity(); _addressAttributeService.InsertAddressAttribute(addressAttribute); //locales UpdateAttributeLocales(addressAttribute, model); SuccessNotification(_localizationService.GetResource("Admin.Address.AddressAttributes.Added")); return(continueEditing ? RedirectToAction("Edit", new { id = addressAttribute.Id }) : RedirectToAction("List")); } //If we got this far, something failed, redisplay form return(View(model)); }
public ActionResult Edit(AddressAttributeModel model, bool continueEditing) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageSettings)) { return(AccessDeniedView()); } var addressAttribute = _addressAttributeService.GetAddressAttributeById(model.Id); if (addressAttribute == null) { //No address attribute found with the specified id return(RedirectToAction("List")); } if (ModelState.IsValid) { addressAttribute = model.ToEntity(addressAttribute); _addressAttributeService.UpdateAddressAttribute(addressAttribute); //locales UpdateAttributeLocales(addressAttribute, model); SuccessNotification(_localizationService.GetResource("Admin.Address.AddressAttributes.Updated")); if (continueEditing) { //selected tab SaveSelectedTabName(); return(RedirectToAction("Edit", new { id = addressAttribute.Id })); } return(RedirectToAction("List")); } //If we got this far, something failed, redisplay form return(View(model)); }
public virtual AddressAttribute UpdateAddressAttributeModel(AddressAttributeModel model, AddressAttribute addressAttribute) { addressAttribute = model.ToEntity(addressAttribute); _addressAttributeService.UpdateAddressAttribute(addressAttribute); return(addressAttribute); }
public ActionResult Edit(AddressAttributeModel model, bool continueEditing) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageSettings)) return AccessDeniedView(); var addressAttribute = _addressAttributeService.GetAddressAttributeById(model.Id); if (addressAttribute == null) //No address attribute found with the specified id return RedirectToAction("List"); if (ModelState.IsValid) { addressAttribute = model.ToEntity(addressAttribute); _addressAttributeService.UpdateAddressAttribute(addressAttribute); //locales UpdateAttributeLocales(addressAttribute, model); SuccessNotification(_localizationService.GetResource("Admin.Address.AddressAttributes.Updated")); if (continueEditing) { //selected tab SaveSelectedTabName(); return RedirectToAction("Edit", new {id = addressAttribute.Id}); } return RedirectToAction("List"); } //If we got this far, something failed, redisplay form return View(model); }