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 store.Url = store.Url.EnsureEndsWith("/"); _storeService.InsertStore(store); NotifySuccess(_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 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) return RedirectToAction("List"); if (ModelState.IsValid) { store = model.ToEntity(store); MediaHelper.UpdatePictureTransientStateFor(store, s => s.LogoPictureId); //ensure we have "/" at the end store.Url = store.Url.EnsureEndsWith("/"); _storeService.UpdateStore(store); NotifySuccess(_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 PrepareStoreModel(model, store); return View(model); }