public ActionResult Create(StoreModel model, bool continueEditing) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageStores)) return AccessDeniedView(); if (ModelState.IsValid) { var store = model.ToEntity(); //ensure we have "/" at the end if (!store.Url.EndsWith("/")) store.Url += "/"; _storeService.InsertStore(store); //locales UpdateAttributeLocales(store, model); SuccessNotification(_localizationService.GetResource("Admin.Configuration.Stores.Added")); return continueEditing ? RedirectToAction("Edit", new { id = store.Id }) : RedirectToAction("List"); } //If we got this far, something failed, redisplay form //languages PrepareLanguagesModel(model); return View(model); }
public ActionResult Edit(StoreModel model, bool continueEditing) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageStores)) return AccessDeniedView(); var store = _storeService.GetStoreById(model.Id); if (store == null) //No store found with the specified id return RedirectToAction("List"); if (ModelState.IsValid) { store = model.ToEntity(store); //ensure we have "/" at the end if (!store.Url.EndsWith("/")) store.Url += "/"; _storeService.UpdateStore(store); //locales UpdateAttributeLocales(store, model); SuccessNotification(_localizationService.GetResource("Admin.Configuration.Stores.Updated")); return continueEditing ? RedirectToAction("Edit", new { id = store.Id }) : RedirectToAction("List"); } //If we got this far, something failed, redisplay form return View(model); }