Esempio n. 1
0
        public ActionResult Edit(StoreMappingModel model, bool continueEditing)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageStores))
            {
                return(AccessDeniedView());
            }

            var storeMapping = _storeMappingService.GetStoreMappingById(model.Id);

            if (storeMapping == null)
            {
                //No store found with the specified id
                return(RedirectToAction("List"));
            }

            if (ModelState.IsValid)
            {
                storeMapping = model.ToEntity(storeMapping);
                _storeMappingService.UpdateStoreMapping(storeMapping);

                SuccessNotification(_localizationService.GetResource("Admin.Configuration.Stores.Updated"));
                return(continueEditing ? RedirectToAction("Edit", new { id = storeMapping.Id }) : RedirectToAction("List"));
            }

            //If we got this far, something failed, redisplay form
            return(View(model));
        }
Esempio n. 2
0
        public ActionResult Create(StoreMappingModel model, bool continueEditing)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageStores))
            {
                return(AccessDeniedView());
            }

            if (ModelState.IsValid)
            {
                var storeMapping = model.ToEntity();
                _storeMappingService.InsertStoreMapping(storeMapping);

                SuccessNotification(_localizationService.GetResource("Admin.Configuration.Stores.Added"));
                return(continueEditing ? RedirectToAction("Edit", new { id = storeMapping.Id }) : RedirectToAction("List"));
            }
            //If we got this far, something failed, redisplay form
            return(View(model));
        }