public ActionResult Edit(int id) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageStores)) { return(AccessDeniedView()); } var storeMapping = _storeMappingService.GetStoreMappingById(id); if (storeMapping == null) { //No store found with the specified id return(RedirectToAction("List")); } var model = storeMapping.ToModel(); //stores var AllStores = _storeService.GetAllStoresByEntityName(_workContext.CurrentCustomer.Id, "Stores"); if (AllStores.Count <= 0) { AllStores = _storeService.GetAllStores(); model.AvailableStores.Add(new SelectListItem() { Text = _localizationService.GetResource("Admin.Common.All"), Value = "0" }); } foreach (var s in AllStores) { model.AvailableStores.Add(new SelectListItem() { Text = s.Name, Value = s.Id.ToString() }); } //Customer int[] searchCustomerRoleIds = new int[] { 3 }; foreach (var s in _customerService.GetAllCustomers(customerRoleIds: searchCustomerRoleIds)) { model.AvailableCustomers.Add(new SelectListItem() { Text = s.Email, Value = s.Id.ToString() }); } return(View(model)); }
/// <summary> /// Gets a store mapping record /// </summary> /// <param name="storeMappingId">Store mapping record identifier</param> /// <returns>Store mapping record</returns> public StoreMapping GetStoreMappingById(int storeMappingId) { return(_storeMappingService.GetStoreMappingById(storeMappingId)); }