public async Task <IActionResult> Edit(ContactAttributeModel model, bool continueEditing) { var contactAttribute = await _contactAttributeService.GetContactAttributeById(model.Id); if (contactAttribute == null) { //No contact attribute found with the specified id return(RedirectToAction("List")); } if (ModelState.IsValid) { contactAttribute = await _contactAttributeViewModelService.UpdateContactAttributeModel(contactAttribute, model); SuccessNotification(_localizationService.GetResource("Admin.Catalog.Attributes.ContactAttributes.Updated")); if (continueEditing) { //selected tab await SaveSelectedTabIndex(); return(RedirectToAction("Edit", new { id = contactAttribute.Id })); } return(RedirectToAction("List")); } //If we got this far, something failed, redisplay form //Stores await model.PrepareStoresMappingModel(contactAttribute, _storeService, true); //ACL await model.PrepareACLModel(contactAttribute, true, _customerService); await _contactAttributeViewModelService.PrepareConditionAttributes(model, contactAttribute); return(View(model)); }
//create public IActionResult Create() { var model = new ContactAttributeModel(); //locales AddLocales(_languageService, model.Locales); //Stores model.PrepareStoresMappingModel(null, false, _storeService); //ACL model.PrepareACLModel(null, false, _customerService); //condition _contactAttributeViewModelService.PrepareConditionAttributes(model, null); return(View(model)); }
public IActionResult Create(ContactAttributeModel model, bool continueEditing) { if (ModelState.IsValid) { var contactAttribute = _contactAttributeViewModelService.InsertContactAttributeModel(model); SuccessNotification(_localizationService.GetResource("Admin.Catalog.Attributes.ContactAttributes.Added")); return(continueEditing ? RedirectToAction("Edit", new { id = contactAttribute.Id }) : RedirectToAction("List")); } //If we got this far, something failed, redisplay form //Stores model.PrepareStoresMappingModel(null, true, _storeService); //ACL model.PrepareACLModel(null, true, _customerService); return(View(model)); }